Skip to content

Commit ebaadcb

Browse files
committed
updates
1 parent bbdeab8 commit ebaadcb

File tree

5 files changed

+23
-29
lines changed

5 files changed

+23
-29
lines changed

.github/workflows/main.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,7 @@ jobs:
9393
with:
9494
file: Dockerfile.gl
9595
push: true
96-
tags: ghcr.io/splunk/biased_lang_gitlab:test
96+
tags: |
97+
ghcr.io/splunk/biased_lang_gitlab:test
98+
ghcr.io/splunk/biased_lang_gitlab:1.0.0
9799
#TODO: Find way to test GitLab side of things

README.md

+14-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Description
22

3-
This is a code linter that checks for biased language in a code repository.
3+
This is a code linter that checks for biased language in a code repository. Currently the words we are searching for are listed in `word_list.csv`.
44

55
1. [Quickstart](#quickstart)
66
2. [Developer Instructions](#developer-instructions)
@@ -68,24 +68,22 @@ Follow these instructions to set up Biased Lang Linter locally for development.
6868
### Required Dependencies
6969

7070
- python 3.7+
71-
- ripgrep (Installation instructions [here](https://github.com/BurntSushi/ripgrep#installation). On MacOS, `brew install ripgrep`.)
72-
73-
### JSON output
74-
75-
**JSON output:** `run_json.py` outputs formatted JSON summaries, can send results to Splunk, and has additional options that are helpful for GitLab CI pipelines.
71+
- ripgrep (Installation instructions [here](https://github.com/BurntSushi/ripgrep#installation).
7672

7773
### More on [args]
7874

79-
Unless otherwise noted, all arguments are available for both JSON and standard output. Required arguments: `--path` and `--mode`.
75+
Below is a list of arguments you can pass to the CLI tool.
76+
Note: For the additional arguments you find in `run_json.py` that aren't listed below, they are for internal use.
8077

8178
- **`--path=`** [_**required**_] absolute path to the directory
8279
- **`--mode=`** [_**required**_] `check` to scan for bias language
8380
- **`--verbose`** enables explicit logging (only applicable for check mode)
8481
- **`--err_file=`** sends any error messages to a log file of your choice, in addition to the console
85-
- **`--splunk`** not available yet (Splunk instance required)
86-
- **`--splunk_token=`** not available yet (Splunk instance required)
87-
- **`--url=`** not available yet (Splunk instance required)
88-
- **`--github_repo=`** not available yet (Splunk instance required)
82+
- **`--splunk`** [_**splunk_required**_] not available yet
83+
- **`--splunk_token=`** [_**splunk_required**_] not available yet
84+
- **`--url=`** [_**splunk_required**_] the project url. This will be the `sourcetype` in Splunk.
85+
- **`--github_repo=`** [_**github_only**_] the repository path for repo's run in GitHub Actions. Also acts as a flag to confirm GitHub environment
86+
8987

9088
### Usage Example
9189

@@ -139,15 +137,7 @@ python3 run_json.py --mode=check --path=/user/jdoe/git/myProject
139137

140138
## Formatting of word_list.csv
141139

142-
When running, `1 to 1` option the `biasedWord` will be directly replaced by the `allowedWord` if `--mode=fix` (Currently not availble).
143-
When running with many options it won't replace automatically, but it shows your provided options for your context.
144-
145-
```sh
146-
# 1 to many options
147-
biasedWord,"option1,option2"
148-
# 1 to 1 option
149-
biasedWord,allowedWord
150-
```
140+
The biased words are listed on a new line. If you would like to propose a new biased word, we will need to
151141

152142
## Excluding directories and files
153143

@@ -170,3 +160,7 @@ If the pipeline detects biased language anywhere in the repository, the `biased_
170160
**Q: I'm including git submodules in my repo and seems to be breaking the workflow, what can I do?**
171161

172162
**A:** You'll need to add your submodule paths in the `.biased_lang_exclude` file. You can find info on how to (exclude files and directories here)[#excluding-directories-and-files]
163+
164+
## Learn More
165+
166+
- Write Unbiased Documentation: [Splunk Style Guide](https://docs.splunk.com/Documentation/StyleGuide/current/StyleGuide/Inclusivity)

run_json.py

-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def build_args_dict(args=None):
4848
parser.add_argument('--path')
4949
parser.add_argument('--url')
5050
parser.add_argument('--mode')
51-
parser.add_argument('--splunk_logs', action='store_true')
5251
parser.add_argument('--verbose', action='store_true')
5352
parser.add_argument('--err_file')
5453
parser.add_argument('--splunk', action='store_true')
@@ -87,7 +86,6 @@ def build_args_dict(args=None):
8786
'mode': mode,
8887
'is_verbose': args.verbose,
8988
'splunk_flag': args.splunk,
90-
'enable_logs': args.splunk_logs,
9189
'err_file': args.err_file,
9290
'h_endpoint': args.h_endpoint,
9391
'splunk_token': args.splunk_token,

tests/unit/test_unit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_open_csv():
6868
data = open_csv('word_list.csv')
6969
assert len(data) == 4
7070
for w in data:
71-
assert len(w) == 2
71+
assert len(w) == 1
7272

7373

7474
def test_write_file():
@@ -115,7 +115,7 @@ def test_build_args_dict():
115115
assert args['path'] == mock_repo_path
116116
assert args['mode'] == 'check'
117117
assert args['err_file'] == constants.ERR_FILE
118-
assert len(args) == 12
118+
assert len(args) == 11
119119

120120

121121
def test_process_word_occurrences(batch_info):

word_list.csv

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
master,"main,primary"
2-
blacklist,blocklist
3-
whitelist,allowlist
4-
slave,worker
1+
master
2+
blacklist
3+
whitelist
4+
slave

0 commit comments

Comments
 (0)