Skip to content

Commit b406af3

Browse files
committed
Try to apply automatically detected jslintrc for pylint
1 parent 40d79ea commit b406af3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Short version of `--migrate-modules` option to `odoo-helper ci do-forwardport`: `--mm`.
88
So, now forwardport command could look like: `odoo-helper ci do-forward-port -s 12.0 --mm`
9+
- Automatically detect `.jslintrc` placed in repo root directory. If found, then apply it to pylint by default.
910

1011
## Release 0.12.1 (2021-10-25)
1112

lib/lint.bash

+15
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ function lint_run_pylint {
8585
local pylint_rc
8686
local pylint_opts;
8787
local pylint_disable="manifest-required-author";
88+
local guess_jslintrc=1;
8889

8990
pylint_rc=$(config_get_default_tool_conf "pylint_odoo.cfg");
9091

@@ -99,12 +100,26 @@ function lint_run_pylint {
99100
pylint_opts+=( "$1" );
100101
elif [[ "$1" =~ --pylint-conf=(.+) ]]; then
101102
pylint_rc=$(config_get_default_tool_conf "${BASH_REMATCH[1]}")
103+
elif [[ "$1" =~ --jslintrc.* ]]; then
104+
guess_jslintrc=0;
105+
pylint_opts+=( "$1" );
102106
else
103107
pylint_opts+=( "$1" );
104108
fi
105109
shift;
106110
done
107111

112+
if ! git_is_git_repo "$1"; then
113+
guess_jslintrc=0;
114+
else
115+
local repo_path;
116+
repo_path=$(git_get_abs_repo_path "$1");
117+
if [ -e "${repo_path}/.jslintrc" ]; then
118+
echoe -e "${BLUEC}INFO${NC}: Applying auto-detected repo-wide jslintrc ${BLUEC}${repo_path}/.jslintrc${NC}.";
119+
pylint_opts+=( "--jslintrc" "${repo_path}/.jslintrc" );
120+
fi
121+
fi
122+
108123
# specify valid odoo version for pylint manifest version check
109124
pylint_opts+=( "--rcfile=$pylint_rc" "--valid_odoo_versions=$ODOO_VERSION" );
110125

0 commit comments

Comments
 (0)