From 0f1cfc1a330ae3f19d937b27162c2d2072256c68 Mon Sep 17 00:00:00 2001 From: Ilya Vlasov Date: Mon, 2 Aug 2021 10:56:57 +0300 Subject: [PATCH 1/8] Fixed issue #73 --- src/python/review/inspectors/pmd/files/bin/basic.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/python/review/inspectors/pmd/files/bin/basic.xml b/src/python/review/inspectors/pmd/files/bin/basic.xml index 09961647..724ee58b 100644 --- a/src/python/review/inspectors/pmd/files/bin/basic.xml +++ b/src/python/review/inspectors/pmd/files/bin/basic.xml @@ -127,7 +127,12 @@ - + + + + + From 49f63d04758c4b4025f28034db4bbef499eda461 Mon Sep 17 00:00:00 2001 From: Ilya Vlasov <55441714+GirZ0n@users.noreply.github.com> Date: Mon, 2 Aug 2021 11:32:20 +0300 Subject: [PATCH 2/8] Fixed #75 --- .github/workflows/build.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0fa5ce3..190909d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,17 @@ jobs: # TODO: remove R504, A003, E800, E402, WPS1, WPS2, WPS3, WPS4, WPS5, WPS6, H601 flake8 . --count --max-complexity=11 --max-line-length=120 --max-doc-length=120 --ignore=R504,A003,E800,E402,W503,WPS1,WPS2,WPS3,WPS4,WPS5,WPS6,H601 --statistics --exclude=.git,__pycache__,docs/source/conf.py,old,build,dist,venv,test/resources,.eggs,review.egg-info,.pytest_cache,node_modules + - name: Check whitelists are sorted + run: | + for file in "whitelist.txt" "src/python/review/inspectors/flake8/whitelist.txt" + do + if [! sort -c $file] + then + echo "$file is not sorted" + exit 1 + fi + done + - name: Set up Eslint run: | # Consistent with eslint version in Dockerfile @@ -44,4 +55,4 @@ jobs: - name: Check installed module can run js linters run: | - python src/python/review/run_tool.py test/resources/inspectors/js/case0_no_issues.js \ No newline at end of file + python src/python/review/run_tool.py test/resources/inspectors/js/case0_no_issues.js From 3f81d11c8eb8b254e08ebcc00a35deb626f03c27 Mon Sep 17 00:00:00 2001 From: Ilya Vlasov <55441714+GirZ0n@users.noreply.github.com> Date: Mon, 2 Aug 2021 11:40:09 +0300 Subject: [PATCH 3/8] Small fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 190909d4..77d29efe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: run: | for file in "whitelist.txt" "src/python/review/inspectors/flake8/whitelist.txt" do - if [! sort -c $file] + if ![sort -c $file] then echo "$file is not sorted" exit 1 From 4648e0929772fec59098533507bd0db4860b9c7b Mon Sep 17 00:00:00 2001 From: Ilya Vlasov <55441714+GirZ0n@users.noreply.github.com> Date: Mon, 2 Aug 2021 11:54:47 +0300 Subject: [PATCH 4/8] Small fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77d29efe..3e2c0c31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: run: | for file in "whitelist.txt" "src/python/review/inspectors/flake8/whitelist.txt" do - if ![sort -c $file] + if ! sort -c $file then echo "$file is not sorted" exit 1 From 278b6b0e88419d6837272eef7a9009560d48de0b Mon Sep 17 00:00:00 2001 From: Ilya Vlasov Date: Mon, 2 Aug 2021 12:01:02 +0300 Subject: [PATCH 5/8] Sorted the whitelist.txt --- whitelist.txt | 298 +++++++++++++++++++++++++------------------------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/whitelist.txt b/whitelist.txt index 18fd4cb7..3f54b12f 100644 --- a/whitelist.txt +++ b/whitelist.txt @@ -1,191 +1,191 @@ +abstractmethod +astype +Atclause +bce +Binarizer capsys +case18 +case34 +cbo +changelog Checkstyle -conftest -Cyclomatic -Detekt -dirs -ECMA -EXPR -file -FUNC -IGNORECASE -INTELLIJ -Intelli -interop -IssueType -JS -Multithreading -Spotbugs -SpringLint -abstractmethod +cloneable +concat config +conftest +CONST +consts +copytree coroutines csv +Ctor +cuda +Cyclomatic +dataflow +dataframe +dataframes +dataloader +dataset +datasets +dedent desc +Detekt +df +dicts +dirname +dirs +dit +dont DOTALL +dropna +dtype +dyn +ECMA +EPS eq eslint etree +eval +Eval exc +EXPR exprs +f1 +file +fillna +formatter +fs +fullmatch +FUNC +getitem getline getroot +getuid gradle +groupby +hashtable +hyperstyle +idx +IGNORECASE +iloc inerop +initializer +inplace +instantiation +Intelli +INTELLIJ +interop +isin +isna +IssueType +iterrows javac +Javadoc +JPG +JS json jsons jsonschema +KTS +lcom linecache lineno +linesep +listdir +loc +logits +maintainabilities +matcher +mccabe +mcs +Measurer min +misrefactored +mlb +Multilabel +multiline +Multithreading +Namespace +ncss +ndarray +nl +nn +noc +nom noqa +nrows +num +numpy +OOP +openpyxl +pandarallel +param parametrize +params +parsers +pathlib pathlib +Pickler +plotly pmd +PNG +Popen +pred +preprocess +preprocessing +pretrained +println +Punisher +puppycrawl pyast pylint +qodana +QodanaDataset readouterr +reindex +removeprefix rfind +rmdir +Runtime +setdefault +sigmoid +Singleline +sklearn +slf4j +splitext +Spotbugs +SpringLint +# Springlint issues +sqrt +src +stmts subdir subdirs +sublist +SVG sym -unlink -utils -param -params -changelog -multiline -sqrt -WPS -OOP -mccabe -mcs -dicts -misrefactored -src textwrap -dedent -maintainabilities -parsers -fs -KTS -nl -splitext -dirname -hyperstyle -XLSX -Eval -eval -openpyxl -dataframe -writelines -rmdir -df -unique -Punisher -# Springlint issues -cbo -dit -lcom -noc -nom -wmc -util -Namespace -case18 -case34 tmp -pandarallel -isin -loc -uniq -fullmatch -iloc -dataframes -numpy -Pickler -Unpickler -dataset -qodana -listdir -concat -copytree -iterrows -nrows -groupby -getuid -Popen -reindex -datasets -usecols -linesep -plotly -JPG -WEBP -SVG -EPS -xaxis -preprocessing -num -dataloader -dtype -pretrained -logits -sigmoid -astype -Multilabel tokenizer -pred Tokenizer -bce -nn -warmup -sklearn -Binarizer -mlb -fillna -inplace -getitem -idx -QodanaDataset -cuda -f1 -WANDB -preprocess -PNG -consts -Measurer -ndarray -Runtime -matcher -pathlib -instantiation -initializer -formatter -unsynchronized +Uncommented +uniq +unique unit4 unit5 -ncss -hashtable +unlink +Unpickler +unsynchronized +usecols +util +utils varargs -println -dataflow -dont -stmts -cloneable -slf4j -removeprefix -Javadoc -Uncommented -Singleline +WANDB +warmup +WEBP +wmc +WPS +writelines +xaxis +XLSX Xpath -Ctor -Atclause -puppycrawl -CONST -isna -dropna -sublist -dyn -setdefault From 35e05197b259b419ba3f691821a71d0f70ba1b61 Mon Sep 17 00:00:00 2001 From: Ilya Vlasov Date: Mon, 2 Aug 2021 12:58:11 +0300 Subject: [PATCH 6/8] Sorted whitelist.txt --- whitelist.txt | 89 +++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/whitelist.txt b/whitelist.txt index 3f54b12f..4954ac30 100644 --- a/whitelist.txt +++ b/whitelist.txt @@ -1,26 +1,26 @@ abstractmethod astype -Atclause +atclause bce -Binarizer +binarizer capsys case18 case34 cbo changelog -Checkstyle +checkstyle cloneable concat config conftest -CONST +const consts copytree coroutines csv -Ctor +ctor cuda -Cyclomatic +cyclomatic dataflow dataframe dataframes @@ -29,26 +29,26 @@ dataset datasets dedent desc -Detekt +detekt df dicts dirname dirs dit dont -DOTALL +dotall dropna dtype dyn -ECMA -EPS +ecma +eps eq eslint etree eval -Eval +eval exc -EXPR +expr exprs f1 file @@ -56,7 +56,7 @@ fillna formatter fs fullmatch -FUNC +func getitem getline getroot @@ -66,27 +66,27 @@ groupby hashtable hyperstyle idx -IGNORECASE +ignorecase iloc inerop initializer inplace instantiation -Intelli -INTELLIJ +intelli +intellij interop isin isna -IssueType +issuetype iterrows javac -Javadoc -JPG -JS +javadoc +jpg +js json jsons jsonschema -KTS +kts lcom linecache lineno @@ -98,14 +98,14 @@ maintainabilities matcher mccabe mcs -Measurer +measurer min misrefactored mlb -Multilabel +multilabel multiline -Multithreading -Namespace +multithreading +namespace ncss ndarray nl @@ -116,7 +116,7 @@ noqa nrows num numpy -OOP +oop openpyxl pandarallel param @@ -124,68 +124,65 @@ parametrize params parsers pathlib -pathlib -Pickler +pickler plotly pmd -PNG -Popen +png +popen pred preprocess preprocessing pretrained println -Punisher +punisher puppycrawl pyast pylint qodana -QodanaDataset +qodanadataset readouterr reindex removeprefix rfind rmdir -Runtime +runtime setdefault sigmoid -Singleline +singleline sklearn slf4j splitext -Spotbugs -SpringLint -# Springlint issues +spotbugs +springlint sqrt src stmts subdir subdirs sublist -SVG +svg sym textwrap tmp tokenizer -Tokenizer -Uncommented +uncommented uniq unique unit4 unit5 unlink -Unpickler +unpickler unsynchronized usecols util utils varargs -WANDB +wandb warmup -WEBP +webp wmc -WPS +wps writelines xaxis -XLSX -Xpath +xlsx +xpath From baf1bbb379056ea1383324a6a48168857c3aaf68 Mon Sep 17 00:00:00 2001 From: Ilya Vlasov Date: Mon, 2 Aug 2021 13:10:24 +0300 Subject: [PATCH 7/8] Fixed tests --- test/python/inspectors/test_pmd_inspector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/python/inspectors/test_pmd_inspector.py b/test/python/inspectors/test_pmd_inspector.py index 03957f20..4a8001e6 100644 --- a/test/python/inspectors/test_pmd_inspector.py +++ b/test/python/inspectors/test_pmd_inspector.py @@ -84,7 +84,7 @@ def test_output_parsing(file_name: str, expected_issues: List[CodeIssue]): FILE_NAMES_AND_N_ISSUES = [ ('test_algorithm_with_scanner.java', 0), ('test_simple_valid_program.java', 0), - ('test_boolean_expr.java', 2), + ('test_boolean_expr.java', 1), ('test_class_with_booleans.java', 3), ('test_closing_streams.java', 1), ('test_code_with_comments.java', 0), @@ -105,7 +105,7 @@ def test_output_parsing(file_name: str, expected_issues: List[CodeIssue]): ('test_thread_run.java', 1), ('test_unused_imports.java', 4), ('test_valid_algorithm_1.java', 0), - ('test_valid_curly_braces.java', 1), + ('test_valid_curly_braces.java', 0), ('test_when_only_equals_overridden.java', 1), ('test_valid_spaces.java', 0), ] From 69baf2de114147e68cc7f61b5fb8f84f50cf57eb Mon Sep 17 00:00:00 2001 From: Ilya Vlasov Date: Mon, 2 Aug 2021 13:19:54 +0300 Subject: [PATCH 8/8] Fixed flake8 --- whitelist.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/whitelist.txt b/whitelist.txt index 4954ac30..67d97c06 100644 --- a/whitelist.txt +++ b/whitelist.txt @@ -52,6 +52,7 @@ expr exprs f1 file +filemode fillna formatter fs @@ -77,6 +78,7 @@ intellij interop isin isna +isnull issuetype iterrows javac