Skip to content

Commit 2279686

Browse files
authored
Merge pull request #235 from 0xalpharush/bump-linter
Bump linter
2 parents 4d35e4b + 7cfa3d4 commit 2279686

21 files changed

+52
-49
lines changed

.github/workflows/black.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
cp pyproject.toml .github/linters
3434
3535
- name: Black
36-
uses: docker://github/super-linter:v3
36+
uses: docker://github/super-linter:v4
3737
if: always()
3838
env:
3939
# run linter on everything to catch preexisting problems

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
TEST_TYPE: ${{ matrix.type }}
3333
GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }}
3434
run: |
35-
bash scripts/travis_test_${TEST_TYPE}.sh
35+
bash "scripts/travis_test_${TEST_TYPE}.sh"

.github/workflows/etherscan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
TEST_TYPE: ${{ matrix.type }}
3232
GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }}
3333
run: |
34-
bash scripts/travis_test_${TEST_TYPE}.sh
34+
bash "scripts/travis_test_${TEST_TYPE}.sh"

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
cp pyproject.toml .github/linters
3434
3535
- name: Lint everything else
36-
uses: docker://github/super-linter:v3
36+
uses: docker://github/super-linter:v4
3737
if: always()
3838
env:
3939
# run linter on everything to catch preexisting problems

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
cp mypy.ini .github/linters
3434
3535
- name: Mypy
36-
uses: docker://github/super-linter:v3
36+
uses: docker://github/super-linter:v4
3737
if: always()
3838
env:
3939
# run linter on everything to catch preexisting problems

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
cp pyproject.toml .github/linters
3434
3535
- name: Pylint
36-
uses: docker://github/super-linter:v3
36+
uses: docker://github/super-linter:v4
3737
if: always()
3838
env:
3939
# run linter on everything to catch preexisting problems

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ crytic-compile uses the pull request contribution model. Please make an account
1414

1515
Some pull request guidelines:
1616

17-
- Work from the [`dev`](https://github.com/crytic/crytic-compile/tree/dev) branch. We performed extensive tests prior to merging anything to `master`, working from `dev` will allow us to merge your work faster.
17+
- Work from the [`dev`](https://github.com/crytic/crytic-compile/tree/dev) branch. We perform extensive tests prior to merging anything to `master`, working from `dev` will allow us to merge your work faster.
1818
- Minimize irrelevant changes (formatting, whitespace, etc) to code that would otherwise not be touched by this patch. Save formatting or style corrections for a separate pull request that does not make any semantic changes.
1919
- When possible, large changes should be split up into smaller focused pull requests.
2020
- Fill out the pull request description with a summary of what your patch does, key changes that have been made, and any further points of discussion, if applicable.
@@ -35,7 +35,7 @@ To run them locally:
3535
- `darglint crytic_compile`
3636

3737

38-
We use pylint `2.8.2`, black `20.8b1`, mypy `0.812` and dargling `1.8.0`.
38+
We use pylint `2.12.2`, black `21.10b0`, mypy `0.812` and darglint `1.8.0`.
3939

4040
## Development Environment
4141
Instructions for installing a development version of crytic-compile can be found in our [wiki](https://github.com/crytic/crytic-compile/wiki/Developer-installation).

crytic_compile/compilation_unit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ def _update_bytecode_with_libraries(
618618
if library_found in libraries:
619619
bytecode = re.sub(
620620
re.escape(library_found),
621-
"{:040x}".format(int(libraries[library_found])),
621+
f"{libraries[library_found]:0>40x}",
622622
bytecode,
623623
)
624624
return bytecode

crytic_compile/crytic_compile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str):
9191
# This is not memory optimized, but allow an offset lookup in O(1)
9292
# Because we frequently do this lookup in Slither during the AST parsing
9393
# We decided to favor the running time versus memory
94-
self._cached_offset_to_line: Dict[Filename, Dict[int, Tuple[int, int]]] = dict()
94+
self._cached_offset_to_line: Dict[Filename, Dict[int, Tuple[int, int]]] = {}
9595
# Lines are indexed from 1
9696
self._cached_line_to_offset: Dict[Filename, Dict[int, int]] = defaultdict(dict)
9797

9898
# Return the line from the line number
9999
# Note: line 1 is at index 0
100-
self._cached_line_to_code: Dict[Filename, List[bytes]] = dict()
100+
self._cached_line_to_code: Dict[Filename, List[bytes]] = {}
101101

102102
self._working_dir = Path.cwd()
103103

@@ -259,7 +259,7 @@ def _get_cached_offset_to_line(self, file: Filename) -> None:
259259

260260
source_code = self._cached_line_to_code[file]
261261
acc = 0
262-
lines_delimiters: Dict[int, Tuple[int, int]] = dict()
262+
lines_delimiters: Dict[int, Tuple[int, int]] = {}
263263
for line_number, x in enumerate(source_code):
264264
self._cached_line_to_offset[file][line_number + 1] = acc
265265

@@ -630,7 +630,7 @@ def compile_all(target: str, **kwargs: str) -> List[CryticCompile]:
630630
compilations = load_from_zip(target)
631631
elif target.endswith(".zip.base64"):
632632
with tempfile.NamedTemporaryFile() as tmp:
633-
with open(target) as target_file:
633+
with open(target, encoding="base64") as target_file:
634634
tmp.write(base64.b64decode(target_file.read()))
635635
compilations = load_from_zip(tmp.name)
636636
else:

crytic_compile/platform/abstract_platform.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ def __init__(self, target: str, **_kwargs: str):
4545
"""
4646
if not self.NAME:
4747
raise IncorrectPlatformInitialization(
48-
"NAME is not initialized {}".format(self.__class__.__name__)
48+
f"NAME is not initialized {self.__class__.__name__}"
4949
)
5050

5151
if not self.PROJECT_URL:
5252
raise IncorrectPlatformInitialization(
53-
"PROJECT_URL is not initialized {}".format(self.__class__.__name__)
53+
f"PROJECT_URL is not initialized {self.__class__.__name__}"
5454
)
5555

5656
if self.TYPE == Type.NOT_IMPLEMENTED:
5757
raise IncorrectPlatformInitialization(
58-
"TYPE is not initialized {}".format(self.__class__.__name__)
58+
f"TYPE is not initialized {self.__class__.__name__}"
5959
)
6060

6161
self._target: str = target
62-
self._cached_dependencies: Dict[str, bool] = dict()
62+
self._cached_dependencies: Dict[str, bool] = {}
6363

6464
# region Properties.
6565
###################################################################################

0 commit comments

Comments
 (0)