Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint format base repo extended #9171

Draft
wants to merge 4 commits into
base: v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ autom4te.cache
/depcomp
/install-sh
/missing
/stamp-h1
/stamp-h1
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
exclude: "\
^(\
.changes|\
.github|\
awscli/examples|\
awscli/topics|\
awscli/botocore|\
awscli/s3transfer|\
awscli/doc|\
exe/assets|\
tests/functional/cloudformation/deploy_templates/booleans/input.yml|\
tests/functional/cloudformation/deploy_templates/nested-tag/input.yml|\
tests/|\
CHANGELOG.rst|\
configure\
)"
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: 'https://github.com/PyCQA/isort'
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
24 changes: 23 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Also, ensure your commit messages match this format::
Describe your changes in the imperative mood, e.g.
"Add foo to bar", "Update foo component for bar",
"Fix race condition for foo".

The body of the commit message can include:

* an explanation of the problem and what this change
Expand Down Expand Up @@ -120,6 +120,28 @@ can run these commands::
When you push to your remote, the output will contain a URL you
can use to open a pull request.

Codestyle
---------
This project uses `ruff <https://github.com/astral-sh/ruff>`__ to enforce
codstyle requirements. We've codified this process using a tool called
`pre-commit <https://pre-commit.com/>`__. pre-commit allows us to specify a
config file with all tools required for code linting, and surfaces either a
git commit hook, or single command, for enforcing these.

To validate your pull request prior to publishing, you can use the following
`installation guide <https://pre-commit.com/#install>`__ to setup pre-commit.

If you don't want to use the git commit hook, you can run the below command
to automatically perform the codestyle validation:

.. code-block:: bash

$ pre-commit run

This will automatically perform simple updates (such as white space clean up)
and provide a list of any failing checks. After these are addressed,
you can commit the changes prior to publishing the pull request.


Reporting Issues
----------------
Expand Down
22 changes: 16 additions & 6 deletions awscli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
----
A Universal Command Line Environment for Amazon Web Services.
"""
import os

import importlib.abc
import os
import sys

__version__ = '2.22.21'
Expand All @@ -36,10 +37,18 @@
os.environ['AWS_DATA_PATH'] = os.pathsep.join(_awscli_data_path)


SCALAR_TYPES = set([
'string', 'float', 'integer', 'long', 'boolean', 'double',
'blob', 'timestamp'
])
SCALAR_TYPES = set(
[
'string',
'float',
'integer',
'long',
'boolean',
'double',
'blob',
'timestamp',
]
)
COMPLEX_TYPES = set(['structure', 'map', 'list'])


Expand All @@ -57,13 +66,14 @@ class TopLevelImportAliasFinder(importlib.abc.MetaPathFinder):
Note: That this import alias only comes into affect if anything is
imported from the awscli package.
"""

_PACKAGES = [
'botocore',
's3transfer',
]
_TARGET_FINDERS = [
'pyimod02_importers.PyiFrozenImporter', # Pyinstaller injected finder
'_frozen_importlib_external.PathFinder' # Built-in path finder
'_frozen_importlib_external.PathFinder', # Built-in path finder
]

def __init__(self, underlying_finder):
Expand Down
1 change: 0 additions & 1 deletion awscli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@

from awscli.clidriver import main


if __name__ == "__main__":
sys.exit(main())
Loading
Loading