Skip to content

Commit

Permalink
Merge pull request #184 from department-of-veterans-affairs/fix-sorting
Browse files Browse the repository at this point in the history
Changes sorting algorithm to sort by first field then second using cs…
  • Loading branch information
karlbrown-va authored Nov 1, 2024
2 parents a8a092e + 0754f3b commit 4006d4c
Show file tree
Hide file tree
Showing 5 changed files with 1,060 additions and 1,076 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ csvlint: ## Runs csvlint on acronyms file

# Other tools
.PHONY: dupe-acronyms
dupe-acronyms: ## prints out duplicated acronyms
dupe-acronyms: $(INSTALL_STAMP) ## prints out duplicated acronyms
@cd scripts; \
./print-dupe-acronyms.sh

.PHONY: dupe-definitions
dupe-definitions: ## prints out duplicated definitions
dupe-definitions: $(INSTALL_STAMP) ## prints out duplicated definitions
@cd scripts; \
./print-dupe-definitions.sh

.PHONY: sort-acronyms
sort-acronyms: $(INSTALL_STAMP) ## Sorts acronyms file by first and second field
"$(POETRY)" run csvsort --ignore-case --columns "Title,Meaning" acronyms.csv | uniq -i > sorted.csv

# spelling
.PHONY: spelling-tool-install
spelling-tool-install: ## Installs spelling tools (only works on OSX for now)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ Any changes to the acronyms file will trigger a CI job that will run lint on the
Any other changes will trigger a scripts-CI job that will run unit tests on scripts in this repository used to cleanup the acronyms file.

## Clean up
The terms can be cleaned up for duplicates and sorted via the cleanup script.

Run it via `cd scripts && ./clean.sh`. An output.csv file will be generated that you can replace the acronyms.csv file with.
The terms can be cleaned up for duplicates and sorted via `make sort-acronyms`. This will output a `sorted.csv` file you can compare with `acronyms.csv` and overwrite if desired.

### csvlint
You can (optionally) install [csvlint](https://github.com/Data-Liberation-Front/csvlint.rb) to check the format of the acronyms file. You can install it with `make csvlint-install` and then run it with `make csvlint`
Expand All @@ -32,4 +30,4 @@ You can (optionally) install [csvlint](https://github.com/Data-Liberation-Front/
* `make format-acronyms` to fix other issues with the acronyms file, such as moving any all-lower-case or all-upper-case definition strings to title case, and turning smart quotes (e.g. “”‘’) to regular quotes. It will output to stdout.
* `make dupe-acronyms` will output to stdout acronyms that have multiple definitions. It can be used to check for potential duplicates.
* `make dupe-definitions` will output to stdout definitions that are the same across different acronyms.
* `make spelling-check` will check the spelling of all of the words in the acronyms file and print out potential errors. You need to run `make spelling-tool-install` first.
* `make spelling-check` will check the spelling of all of the words in the acronyms file and print out potential spelling errors. You need to run `make spelling-tool-install` first.
Loading

0 comments on commit 4006d4c

Please sign in to comment.