-
-
Notifications
You must be signed in to change notification settings - Fork 213
Description
Subject of the feature
The .alexrc.yml file should allow or deny words per selected file.
Problem
It is not possible to allow or deny some words per selected files. Sometimes is needed to allow some words in files but in other files not. For example license Apache 2.0 file contains executed and failure words.
Download Apache 2.0 file:
wget https://www.apache.org/licenses/LICENSE-2.0.txt
Run alex:
podman run -it --rm --volume "$(pwd):/alex:ro,z" --workdir "/alex" registry.gitlab.com/pipeline-components/alex:0.21.9 --why .
It returns status code 1 and prints:
LICENSE-2.0.txt
136:34-136:42 warning Be careful with `executed`, it’s profane in some cases executed retext-profanities
161:54-161:61 warning Be careful with `failure`, it’s profane in some cases failure retext-profanities
⚠ 2 warnings
Creating .alexignore file is not an option because of these issues:
- Ignoring files should not cause error #170
- Files without file extension are not included for linting #338
- Hidden files started with dot are not included for linting #339
Also it will entirely ignore content of whole file and this is also not desired.
Expected behaviour
Create .alexrc.yml with this content:
allow:
- file: LICENSE
words: [executed, failure]
- file: fifo.cpp
words: [pop]It will be also nice if the file: entry will also support glob *.txt, **/*.cpp or regexp .*\.md$ patterns.
Still it should be possible to have backward compatibility with this YAML schema:
allow:
- executed
- failure
- popBecause it almost all YAML parser libraries it is possible to retrieve YAML type:
!!seqis YAML list[]!!mapis YAML object{}
Alternatives
Create .alexrc.yml with this content:
allow:
- executed
- failure
- popBut this allow these words in all files.
Other alternative is using .alexignore file but this will ignore content of whole file and there is also still this issue: #170