From 1cf399a1fa21ec9180dfd5a82b53958bd17a7e37 Mon Sep 17 00:00:00 2001 From: Jefferson Bizarri Date: Thu, 12 Mar 2026 08:43:26 -0300 Subject: [PATCH 1/4] Adiciona mais bins de bandeira master --- creditcard/card.py | 2 ++ tests/unit/test_card.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/creditcard/card.py b/creditcard/card.py index 668ff74..c2952db 100644 --- a/creditcard/card.py +++ b/creditcard/card.py @@ -26,12 +26,14 @@ r"|2720[0-9]{12}" # Suporte aos antigos cartões Maestro que agora são MasterCard r"|5[06789][0-9]{14}" + r"|55020[0-9]{11}" r"|600[689][0-9]{12}" r"|602[468][0-9]{12}" r"|603[0-9]{13}" r"|604[69][0-9]{12}" r"|605[045][0-9]{12}" r"|606[234][0-9]{12}" + r"|6087[0-9]{12}" r"|6095[0-9]{12}" r"|6220[0-9]{12}" r"|627[389][0-9]{12}" diff --git a/tests/unit/test_card.py b/tests/unit/test_card.py index a5d2347..b414971 100644 --- a/tests/unit/test_card.py +++ b/tests/unit/test_card.py @@ -45,6 +45,9 @@ def test_is_valid(self): ("master", "6039137880232543"), # antigo maestro ("master", "6063216106123345"), # antigo maestro ("master", "6392403325708112"), # antigo maestro + ("master", "6087101111111111"), + ("master", "6087831111111111"), + ("master", "5502091111111111"), ("codensa", "8700551111111111"), ("codensa", "5907121111111111"), ("codensa", "5294481111111111"), From f821468e93b25955177007df4ec60ad5f7189a50 Mon Sep 17 00:00:00 2001 From: Jefferson Bizarri Date: Mon, 16 Mar 2026 10:16:25 -0300 Subject: [PATCH 2/4] =?UTF-8?q?Sugest=C3=A3o=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- creditcard/card.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/creditcard/card.py b/creditcard/card.py index c2952db..9d38418 100644 --- a/creditcard/card.py +++ b/creditcard/card.py @@ -17,7 +17,7 @@ "codensa": r"^(870055|590712|529448)[0-9]{10}$", "master": ( r"^" - r"(5[1-5][0-9]{14}" + r"(5[0-9]{15}" r"|2221[0-9]{12}" r"|222[2-9][0-9]{12}" r"|22[3-9][0-9]{13}" @@ -25,8 +25,6 @@ r"|27[01][0-9]{13}" r"|2720[0-9]{12}" # Suporte aos antigos cartões Maestro que agora são MasterCard - r"|5[06789][0-9]{14}" - r"|55020[0-9]{11}" r"|600[689][0-9]{12}" r"|602[468][0-9]{12}" r"|603[0-9]{13}" From e5a5e9627dca69c62190dabdbe9a50c711a2ada4 Mon Sep 17 00:00:00 2001 From: Jefferson Bizarri Date: Mon, 16 Mar 2026 10:26:09 -0300 Subject: [PATCH 3/4] Adiciona workflow de teste --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1df3be2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: 1 Tests + +on: + pull_request: + types: ["opened", "edited", "reopened", "synchronize", "ready_for_review"] + +jobs: + tests: + if: (! github.event.pull_request.draft) && github.head_ref != 'main' && github.head_ref != 'develop' + + runs-on: ubuntu-latest + + steps: + - name: Checkout do código + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Instalar dependências + run: | + python -m pip install --upgrade pip + pip install -r requirements/dev.txt + pip install -r requirements/test.txt + + - name: Rodar testes + run: | + pytest From 073a07d4b1d160e781c70b9afd16e3e2c1a2adca Mon Sep 17 00:00:00 2001 From: Jefferson Bizarri Date: Mon, 16 Mar 2026 10:32:07 -0300 Subject: [PATCH 4/4] Deleta workflow do sonar --- .github/workflows/sonar.yml | 57 ------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 .github/workflows/sonar.yml diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml deleted file mode 100644 index 31f7a15..0000000 --- a/.github/workflows/sonar.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: SonarQube MaisTodos Analysis - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - sonar: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Cache SonarQube packages - uses: actions/cache@v3 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - - name: Download SonarScanner - run: | - curl -sSL -o sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip - if [ ! -s sonar-scanner.zip ]; then - echo "Erro: O arquivo sonar-scanner.zip está vazio ou não foi baixado corretamente." - exit 1 - fi - # Verifica se o arquivo é um ZIP válido - if ! unzip -t sonar-scanner.zip >/dev/null 2>&1; then - echo "Erro: O arquivo sonar-scanner.zip não é um ZIP válido." - exit 1 - fi - - - name: Extract SonarScanner - run: | - unzip -o sonar-scanner.zip - chmod +x sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner - export PATH=$PATH:$PWD/sonar-scanner-5.0.1.3006-linux/bin - - - name: Run SonarQube Scan - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - sonar-scanner \ - -Dsonar.projectKey=MaisTodos.python-creditcard \ - -Dsonar.sources=. \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.scm.provider=git