Skip to content

Commit

Permalink
Add spell checker
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Jan 3, 2025
1 parent 5bfb58f commit 52b6c82
Show file tree
Hide file tree
Showing 18 changed files with 886 additions and 25 deletions.
18 changes: 18 additions & 0 deletions .github/actions/spelling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# check-spelling/check-spelling configuration

File | Purpose | Format | Info
-|-|-|-
[dictionary.txt](dictionary.txt) | Replacement dictionary (creating this file will override the default dictionary) | one word per line | [dictionary](https://github.com/check-spelling/check-spelling/wiki/Configuration#dictionary)
[allow.txt](allow.txt) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow)
[reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject)
[excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes)
[only.txt](only.txt) | Only check matching files (applied after excludes) | perl regular expression | [only](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-only)
[patterns.txt](patterns.txt) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns)
[candidate.patterns](candidate.patterns) | Patterns that might be worth adding to [patterns.txt](patterns.txt) | perl regular expression with optional comment block introductions (all matches will be suggested) | [candidates](https://github.com/check-spelling/check-spelling/wiki/Feature:-Suggest-patterns)
[line_forbidden.patterns](line_forbidden.patterns) | Patterns to flag in checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns)
[expect.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect)
[advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice)
[block-delimiters.list](block-delimiters.list) | Define block begin/end markers to ignore lines of text | line with _literal string_ for **start** followed by line with _literal string_ for **end** | [block ignore](https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Block-Ignore#status)

Note: you can replace any of these files with a directory by the same name (minus the suffix)
and then include multiple files inside that directory (with that suffix) to merge multiple files together.
17 changes: 17 additions & 0 deletions .github/actions/spelling/allow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Allow files are lists of words to accept unconditionally

While check spelling will complain about an expected word
which is no longer present, you can include things here even if
they are not otherwise present in the repository.

E.g., you could include a list of system APIs here, or potential
contributors (so that if a future commit includes their name,
it'll be accepted).

## Files

| File | Description |
| ---- | ----------- |
| [Allow](allow.txt) | Supplements to the dictionary |
| [File Types](filetypes.txt) | File extensions |
| [Names](names.txt) | Names of people |
44 changes: 44 additions & 0 deletions .github/actions/spelling/allow/allow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
aAwdbBGmyYHIpMSfzZjuUVWcxX
abfnrtv
acde
acdeEfFgGiorsuxX
alse
atx
Awdb
bfnrt
BGmy
buuz
clickable
cstdint
embeddings
endblock
endcall
endembed
endmacro
endmytemplate
endraw
endset
endtrans
formatspec
gcc
Giorsux
HIMSj
keepachangelog
lipsum
MSfz
mytemplate
nmstart
nxd
packagecontrol
palletsprojects
pushd
setlocal
somevariable
subl
sublimehq
sublimetext
Versioning
workflows
Wcx
YHIp
Zju
6 changes: 6 additions & 0 deletions .github/actions/spelling/allow/filetypes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
djcss
djhtml
djjson
djt
djyaml
djyml
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/names.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Shenoy
24 changes: 24 additions & 0 deletions .github/actions/spelling/allow/snippets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
forceescape
jautoescape
jblock
jcall
jcomment
jexp
jextends
jfilter
jfor
jif
jifelse
jmacro
jraw
jset
jtrans
jwith
nextitem
previtem
rejectattr
revindex
sameas
selectattr
tojson
xmlattr
6 changes: 6 additions & 0 deletions .github/actions/spelling/excludes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes
(?:^|/)(?i)LICEN[CS]E
(?:^|/)\.github/actions/spelling
(?:^|/)\.gitattributes$
(?:^|/)\.gitignore$
(?:^|/)pyproject.toml
187 changes: 187 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Check Spelling

# Comment management is handled through a secondary job, for details see:
# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions
#
# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment
# (in odd cases, it might actually run just to collapse a comment, but that's fairly rare)
# it needs `contents: write` in order to add a comment.
#
# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment
# or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment)
# it needs `pull-requests: write` in order to manipulate those comments.

# Updating pull request branches is managed via comment handling.
# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list
#
# These elements work together to make it happen:
#
# `on.issue_comment`
# This event listens to comments by users asking to update the metadata.
#
# `jobs.update`
# This job runs in response to an issue_comment and will push a new commit
# to update the spelling metadata.
#
# `with.experimental_apply_changes_via_bot`
# Tells the action to support and generate messages that enable it
# to make a commit to update the spelling metadata.
#
# `with.ssh_key`
# In order to trigger workflows when the commit is made, you can provide a
# secret (typically, a write-enabled github deploy key).
#
# For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key

# SARIF reporting
#
# Access to SARIF reports is generally restricted (by GitHub) to members of the repository.
#
# Requires enabling `security-events: write`
# and configuring the action with `use_sarif: 1`
#
# For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-SARIF-output

# Minimal workflow structure:
#
# on:
# push:
# ...
# pull_request_target:
# ...
# jobs:
# # you only want the spelling job, all others should be omitted
# spelling:
# # remove `security-events: write` and `use_sarif: 1`
# # remove `experimental_apply_changes_via_bot: 1`
# ... otherwise adjust the `with:` as you wish

on:
push:
branches:
- "**"
tags-ignore:
- "**"
pull_request_target:
branches:
- "**"
types:
- "opened"
- "reopened"
- "synchronize"
issue_comment:
types:
- "created"

jobs:
spelling:
name: Check Spelling
permissions:
contents: read
pull-requests: read
actions: read
security-events: write
outputs:
followup: ${{ steps.spelling.outputs.followup }}
runs-on: ubuntu-latest
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
concurrency:
group: spelling-${{ github.event.pull_request.number || github.ref }}
# note: If you use only_check_changed_files, you do not want cancel-in-progress
cancel-in-progress: true
steps:
- name: check-spelling
id: spelling
uses: check-spelling/check-spelling@prerelease
with:
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
checkout: true
check_file_names: 1
spell_check_this: check-spelling/spell-check-this@prerelease
post_comment: 0
use_magic_file: 1
report-timing: 1
warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check,unclosed-block-ignore-begin,unclosed-block-ignore-end
experimental_apply_changes_via_bot: 1
use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }}
extra_dictionary_limit: 20
dictionary_source_prefixes: >
{
"cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/",
"cspell1": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20241114/dictionaries/"
}
check_extra_dictionaries: ''
extra_dictionaries: |
cspell1:css/css.txt
cspell1:django/django.txt
cspell1:django/requirements.txt
cspell1:filetypes/filetypes.txt
cspell1:html/html.txt
cspell1:node/node.txt
cspell1:npm/npm.txt
cspell1:php/php.txt
cspell1:python/additional_words.txt
cspell1:python/common/extra.txt
cspell1:python/python/python-lib.txt
cspell1:python/python/python.txt
cspell1:software-terms/softwareTerms.txt
comment-push:
name: Report (Push)
# If your workflow isn't running on push, you can remove this job
runs-on: ubuntu-latest
needs: spelling
permissions:
actions: read
contents: write
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
steps:
- name: comment
uses: check-spelling/check-spelling@prerelease
with:
checkout: true
spell_check_this: check-spelling/spell-check-this@prerelease
task: ${{ needs.spelling.outputs.followup }}

comment-pr:
name: Report (PR)
# If you workflow isn't running on pull_request*, you can remove this job
runs-on: ubuntu-latest
needs: spelling
permissions:
actions: read
contents: read
pull-requests: write
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
steps:
- name: comment
uses: check-spelling/check-spelling@prerelease
with:
checkout: true
spell_check_this: check-spelling/spell-check-this@prerelease
task: ${{ needs.spelling.outputs.followup }}
experimental_apply_changes_via_bot: 1

update:
name: Update PR
permissions:
contents: write
pull-requests: write
actions: read
runs-on: ubuntu-latest
if: ${{
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@check-spelling-bot apply') &&
contains(github.event.comment.body, 'https://')
}}
concurrency:
group: spelling-update-${{ github.event.issue.number }}
cancel-in-progress: false
steps:
- name: apply spelling updates
uses: check-spelling/check-spelling@prerelease
with:
experimental_apply_changes_via_bot: 1
checkout: true
ssh_key: "${{ secrets.CHECK_SPELLING }}"
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Snippets for commonly used Jinja blocks.
- The main syntax file along with syntax test for the scopes.
- Auto completions for builtin tags, filters, tests and functions.
- Abiility to use <kbd>ctrl + /</kbd> for Jinja line comments & <kbd>ctrl + shift + /</kbd> for block comments.
- Ability to use <kbd>ctrl + /</kbd> for Jinja line comments & <kbd>ctrl + shift + /</kbd> for block comments.

## [1.1.0] - 2022-03-27

Expand Down Expand Up @@ -41,5 +41,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.0.0]

- Reorganize whole package
- Rewrite all syntax definitons extending ST's (CSS, JavaScript, JSON, HTML, Markdown, XML, YAML)
- Rewrite all syntax definitions extending ST's (CSS, JavaScript, JSON, HTML, Markdown, XML, YAML)
- fix snippet indentation (now using tabs)
2 changes: 1 addition & 1 deletion Completions/Jinja Filter Names.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"trigger": "title",
"kind": ["markup", "f", "Jinja filter"],
"annotation": "Jinja filter",
"details": "Return a titlecased version of the value.",
"details": "Return a title-cased version of the value.",
},
{
"trigger": "tojson",
Expand Down
2 changes: 1 addition & 1 deletion Completions/Jinja Filters.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
"contents": "title()",
"kind": ["markup", "f", "Jinja filter"],
"annotation": "Jinja filter",
"details": "Return a titlecased version of the value.",
"details": "Return a title-cased version of the value.",
},
{
"trigger": "tojson",
Expand Down
2 changes: 1 addition & 1 deletion Completions/Jinja Function Names.sublime-completions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
// Do not append redunant parentheses when completing within function calls
// Do not append redundant parentheses when completing within function calls
"scope": "source.jinja meta.function-call.identifier",
"completions": [
{
Expand Down
2 changes: 1 addition & 1 deletion Completions/Jinja Test Names.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"trigger": "upper",
"kind": ["namespace", "t", "Jinja test"],
"annotation": "Jinja test",
"details": "Return <code>true</code> if the variable is uppercased.",
"details": "Return <code>true</code> if the variable is upper-cased.",
},
],
}
2 changes: 1 addition & 1 deletion Completions/Jinja Tests.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
"contents": "upper()",
"kind": ["namespace", "t", "Jinja test"],
"annotation": "Jinja test",
"details": "Return <code>true</code> if the variable is uppercased.",
"details": "Return <code>true</code> if the variable is upper-cased.",
},
],
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Completion behaviour of the primary syntax applies to normal content.
Default behaviour of ST involves distinction between `source` and `text` scopes.

- `source` (CSS, JavaScript, JSON, YAML): completions display while typing.
- `text` (HTML, Markdwon, Text, XML): only snippets expand by pressing <kbd>tab</kbd> key.
- `text` (HTML, Markdown, Text, XML): only snippets expand by pressing <kbd>tab</kbd> key.

Content of `{% %}` and `{{ }}` tags is scoped `source.jinja` to enable completions while typing.

Expand Down
Loading

1 comment on commit 52b6c82

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (7)

brequest
btimestamp
catfile
gensym
proxyconnect
ratelimit
SYSTEMROOT

To accept these unrecognized words as correct, you could run the following commands

... in a clone of the [email protected]:Sublime-Instincts/BetterJinja.git repository
on the wip/spelling branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/prerelease/apply.pl' |
perl - 'https://github.com/Sublime-Instincts/BetterJinja/actions/runs/12599178203/attempts/1'

Please sign in to comment.