Skip to content

Typo (Typo)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL
OS
Info Yes 1 badpractice

Parameters

Name Type Description Default value
minWordLength Integer Minimum length for checked words 3
userWordsToIgnore String Dictionary for excluding words (comma separated) ``

Description

Spell checking is done with LanguageTool. The strings are split into camelCase chunks and checked against a built-in dictionary.

Cache

The diagnostic uses persistent disk cache (EhCache) to store information about already checked words. The cache directory path is configured using app.cache.basePath and app.cache.fullPath properties in the application configuration.

By default, the application has:

app.cache.basePath=${user.home}
app.cache.fullPath=

This means that: - Cache will be created in the user directory (${user.home}/.bsl-language-server/cache/<hash>/) - <hash> is an MD5 hash of the absolute path to the current working directory, ensuring cache isolation for different workspaces - Cache is not created in the project's working directory, avoiding clutter in git repositories

To override the cache path, you can use: - app.cache.fullPath — full path to cache directory (if set, used directly) - app.cache.basePath — base path for automatic calculation (defaults to ${user.home})

Example override:

# Set explicit cache path
app.cache.fullPath=/custom/cache/location

# Or change only the base path
app.cache.basePath=/opt/bsl-ls
# Result: /opt/bsl-ls/.bsl-language-server/cache/<hash>/

CI Recommendations:

Important: With the new version, cache is stored by default in the user directory with workspace hash. For CI, it's recommended to explicitly set app.cache.fullPath to simplify caching between builds.

  • GitHub Actions
  • Set explicit cache path in environment variables or configuration
  • Use actions/cache to save the directory between build and test runs
- name: Cache BSL LS Typo
  uses: actions/cache@v3
  with:
    path: .bsl-ls-cache
    key: ${{ runner.os }}-bsl-typo-${{ hashFiles('**/*.bsl') }}
    restore-keys: |
      ${{ runner.os }}-bsl-typo-
  • GitLab CI
  • In .gitlab-ci.yml use the cache section:

    variables:
      APP_CACHE_FULLPATH: ".bsl-ls-cache"
    
    cache:
      key: "bsl-ls-typo-cache"
      paths:
        - .bsl-ls-cache/
      policy: pull-push
    
  • If needed, set a unique key for different branches/runners.

  • Jenkins

  • Set environment variable APP_CACHE_FULLPATH for explicit cache path
  • In pipeline, you can save the cache directory between builds in several ways:
    • Use stash/unstash to transfer data between stages in one build.
    • Use the Workspace Cleanup plugin and configure workspace preservation on the agent (if agents are permanent) or archive the artifact using archiveArtifacts and download it in subsequent builds.
    • For Jenkins with dynamic agents (e.g., Kubernetes), it's recommended to save cache in network storage or object storage (S3) and restore it at the beginning of the job.

General recommendations: - For CI environments, it's recommended to explicitly set app.cache.fullPath (e.g., .bsl-ls-cache in project workspace) to simplify caching - Ensure that the cache path is accessible to the build process and has sufficient permissions.

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:Typo-off
// BSLLS:Typo-on

Parameter for config

"Typo": {
    "minWordLength": 3,
    "userWordsToIgnore": ""
}