Skip to content

Commit

Permalink
Add a linter to check trailing whitespace to pre-commit and CI (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuok authored Oct 9, 2022
1 parent 7448812 commit d26d516
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 15 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@ jobs:
uses: pre-commit/[email protected]
with:
extra_args: yamllint --all-files
lint-trailing-whitespace:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint
uses: pre-commit/[email protected]
with:
extra_args: trailing-whitespace --all-files
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ repos:
rev: v1.28.0
hooks:
- id: yamllint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
6 changes: 3 additions & 3 deletions backend/src/impl/benchmark_configs/globalbench.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
{"op": "max", "group_by": ["source_language"], "skip_group_system": false},
{"op": "weighted_sum", "weight": "source_language", "weight_map": "ling_weight", "skip_group_system": false}
]
},
},
{
"name": "Most-underserved Languages",
"operations": [
{"op": "max", "group_by": ["source_language"], "skip_group_system": true},
{"op": "add_default", "column": "source_language", "default_set": "all_lang", "score": 0},
{"op": "subtract", "num": 1},
{"op": "subtract", "num": 1},
{"op": "multiply", "weight": "source_language", "weight_map": "pop_weight"}
]
}
],
"default_views": ["Linguistic-weighted Global Average", "Demographic-weighted Global Average", "Linguistic-weighted System-by-system Average", "Demographic-weighted System-by-system Average", "Languages", "Original"]
}
}
2 changes: 1 addition & 1 deletion backend/src/impl/benchmark_configs/masakhaner.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"paper":{
"title":"MasakhaNER: Named Entity Recognition for African Languages",
"url":"https://aclanthology.org/2021.tacl-1.66.pdf"
},
},
"metrics": [{"name": "F1"}],
"datasets": [
{"dataset_name": "masakhaner", "sub_dataset": "masakhaner-bam"},
Expand Down
2 changes: 1 addition & 1 deletion backend/templates/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ is an example of building a swagger-enabled Flask server.

This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.

The templates are copied from the [pythonFlaskConnexion folder](https://github.com/swagger-api/swagger-codegen-generators/tree/master/src/main/resources/handlebars/pythonFlaskConnexion)
The templates are copied from the [pythonFlaskConnexion folder](https://github.com/swagger-api/swagger-codegen-generators/tree/master/src/main/resources/handlebars/pythonFlaskConnexion)
under [swagger-codegen-generators](https://github.com/swagger-api/swagger-codegen-generators), commit id `0c69d21044bc4f25584ac4a736d9fd13d432c70f`.

## Requirements
Expand Down
2 changes: 1 addition & 1 deletion deployment/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ server {
proxy_pass http://127.0.0.1:5000;
}
location / {
try_files $uri /index.html;
try_files $uri /index.html;
}
}
2 changes: 1 addition & 1 deletion deployment/serve.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Starts nginx and gunicorn. It is meant for the explainaboard_web
# container only. The script takes any number of gunicorn arguments
# passed in as a string.
# passed in as a string.

nohup nginx -g "daemon off;" & gunicorn -b 0.0.0.0:5000 -t 600 "explainaboard_web.__main__:create_app()" $1
2 changes: 1 addition & 1 deletion frontend/src/components/Analysis/AnalysisDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export function AnalysisDrawer({ systems, closeDrawer }: Props) {
title={getDrawerTitle()}
width="90%"
bodyStyle={{ minWidth: "800px" }}
/*Mark the drawer unclosable when the page is still loading to prevent
/*Mark the drawer unclosable when the page is still loading to prevent
users from exiting before the asycn function finishes.
*/
closable={pageState !== PageState.loading}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Analysis/AnalysisTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function AnalysisTable({ systemID, task, cases, changeState }: Props) {
}
} finally {
changeState(PageState.success);
/*
/*
The table after the 1st scroll may be incomplete as the async API call
is not finished. If we stop there, the bottom portion of the examples will
be concealed. Therefore, we need a 2nd scroll to bring the entire table
Expand All @@ -200,9 +200,9 @@ export function AnalysisTable({ systemID, task, cases, changeState }: Props) {
}
}
refreshSystemOutputs();
/*
/*
1st scroll to the table, which is likely still loading and
incomplete. This is needed so the scroll is immediate and
incomplete. This is needed so the scroll is immediate and
users will not experience a delay due to the async API call.
*/
tableRef.current?.scrollIntoView();
Expand Down
2 changes: 1 addition & 1 deletion openapi/gen_api_layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi
# backend
if [[ $mode == "backend" || $mode == "project" ]]; then
# remove src/gen if exists and generate code
# we also create a link to src/impl in src/gen which contains our own implementation
# we also create a link to src/impl in src/gen which contains our own implementation
cd $project_root && rm -rf $BACKEND_GEN_PATH && \
mkdir -p $BACKEND_GEN_PATH/explainaboard_web && \
cd $BACKEND_GEN_PATH/explainaboard_web/ && \
Expand Down
6 changes: 3 additions & 3 deletions openapi/ts_templates/configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export class Configuration {
apiKey?: string | ((name: string) => string);
/**
* parameter for basic security
*
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
*
* @type {string}
* @memberof Configuration
*/
Expand All @@ -39,7 +39,7 @@ export class Configuration {
accessToken?: string | ((name: string, scopes?: string[]) => string);
/**
* override base path
*
*
* @type {string}
* @memberof Configuration
*/
Expand Down

0 comments on commit d26d516

Please sign in to comment.