diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..0eeb563 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [main] + pull_request: + # The branches below must be a subset of the branches above + branches: [main] + schedule: + - cron: "17 11 * * 4" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["python"] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b8d9e31 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Lint Project + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.11'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev,test] + pip freeze + - name: Lint with pre-commit + run: | + pre-commit --version + pre-commit install + pre-commit run --all-files diff --git a/pyproject.toml b/pyproject.toml index f538253..666c3f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ dependencies = [ "arrow", "black", + "debugpy", "inflect", "isort", "paho.mqtt", diff --git a/tcex_cli/cli/run/launch_abc.py b/tcex_cli/cli/run/launch_abc.py index 12e12b1..33d2680 100644 --- a/tcex_cli/cli/run/launch_abc.py +++ b/tcex_cli/cli/run/launch_abc.py @@ -48,17 +48,17 @@ def create_input_config(self, inputs: BaseModel): encrypted_data = self.util.encrypt_aes_cbc(key, data) # ensure that the in directory exists - inputs.tc_in_path.mkdir(parents=True, exist_ok=True) + inputs.tc_in_path.mkdir(parents=True, exist_ok=True) # type: ignore # write the file in/.app_params.json - app_params_json = inputs.tc_in_path / '.test_app_params.json' + app_params_json = inputs.tc_in_path / '.test_app_params.json' # type: ignore with app_params_json.open(mode='wb') as fh: fh.write(encrypted_data) - # TODO: [high] TEMP - DELETE THIS - app_params_json_decrypted = inputs.tc_in_path / '.test_app_params-decrypted.json' - with app_params_json_decrypted.open(mode='w') as fh: - fh.write(data) + # Test code to write decrypted file for debugging + # app_params_json_decrypted = inputs.tc_in_path / '.test_app_params-decrypted.json' + # with app_params_json_decrypted.open(mode='w') as fh: + # fh.write(data) # when the App is launched the tcex.input module reads the encrypted # file created above # for inputs. in order to decrypt the file, this diff --git a/tcex_cli/cli/run/playbook_create.py b/tcex_cli/cli/run/playbook_create.py index 6b076d4..2a426ed 100644 --- a/tcex_cli/cli/run/playbook_create.py +++ b/tcex_cli/cli/run/playbook_create.py @@ -122,7 +122,7 @@ def validate_value(self): def transform(self) -> str: """Return a string value from bytes.""" - value = base64.b64decode(self.value) + value = base64.b64decode(self.value) # type: ignore return base64.b64encode(value).decode('utf-8') @@ -148,7 +148,7 @@ def transform(self) -> list[str]: """Return a list of string values from a list bytes.""" values = [] for v in self.value: - v = base64.b64decode(v) + v = base64.b64decode(v) # type: ignore values.append(base64.b64encode(v).decode('utf-8')) return values diff --git a/tcex_cli/util b/tcex_cli/util index 638eef9..bf28434 160000 --- a/tcex_cli/util +++ b/tcex_cli/util @@ -1 +1 @@ -Subproject commit 638eef9f4d9e0da9b46ffa3221a73429877f24ad +Subproject commit bf28434dbc53a8acbf7a30edaf9d4f4daaf36a57