Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uppercase for constant variable names. #99

Merged
merged 2 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/finalized_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on: [push, pull_request]

jobs:
change_check:
name: Path match check
name: Check if file changed
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
not_modified: ${{ steps.skip_check.outputs.should_skip }}
modified: ${{ steps.changes.outputs.modified }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
- name: Checkout repository
uses: actions/checkout@v2
with:
github_token: ${{ github.token }}
paths: '["spec/labels-v1.json"]'
fetch-depth: 0
- id: changes
# Set outputs using the command.
run: |
echo "::set-output name=modified::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep spec/labels-v1.json$ | xargs)"
unit_test:
name: Error if finalized spec modified
needs: change_check
if: ${{ needs.change_check.outputs.not_modified != 'true' }}
if: ${{ needs.change_check.outputs.modified }}
runs-on: ubuntu-18.04
steps:
- name: Fail if specs modified
Expand Down
10 changes: 5 additions & 5 deletions js/CompletionCriteria.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// CompletionCriteria

export default {
approx_time: "approx_time",
mastery: "mastery",
pages: "pages",
reference: "reference",
time: "time",
APPROX_TIME: "approx_time",
MASTERY: "mastery",
PAGES: "pages",
REFERENCE: "reference",
TIME: "time",
};
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.1.35"
"version": "0.1.36"
}
30 changes: 15 additions & 15 deletions le_utils/constants/completion_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@

# CompletionCriteria

approx_time = "approx_time"
mastery = "mastery"
pages = "pages"
reference = "reference"
time = "time"
APPROX_TIME = "approx_time"
MASTERY = "mastery"
PAGES = "pages"
REFERENCE = "reference"
TIME = "time"

choices = (
(approx_time, "Approx Time"),
(mastery, "Mastery"),
(pages, "Pages"),
(reference, "Reference"),
(time, "Time"),
(APPROX_TIME, "Approx Time"),
(MASTERY, "Mastery"),
(PAGES, "Pages"),
(REFERENCE, "Reference"),
(TIME, "Time"),
)

COMPLETIONCRITERIALIST = [
approx_time,
mastery,
pages,
reference,
time,
APPROX_TIME,
MASTERY,
PAGES,
REFERENCE,
TIME,
]
2 changes: 1 addition & 1 deletion scripts/generate_from_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def read_constants_specs():
constants_spec = json.load(json_constants_spec_file)
key = snake_to_pascal(constants_spec_file.split("-")[-1].split(".")[0])
constants_outputs[key] = OrderedDict(
[(a, a) for a in sorted(constants_spec)]
[(a.upper(), a) for a in sorted(constants_spec)]
)
return constants_outputs

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup(
name="le-utils",
packages=find_packages(),
version="0.1.35",
version="0.1.36",
description="LE-Utils contains shared constants used in Kolibri, Ricecooker, and Kolibri Studio.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down