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

Custom YAML Style files only accept .yml file extension #891

Open
1 task done
jonathonlacher opened this issue Aug 27, 2024 · 2 comments
Open
1 task done

Custom YAML Style files only accept .yml file extension #891

jonathonlacher opened this issue Aug 27, 2024 · 2 comments

Comments

@jonathonlacher
Copy link

Check for existing issues

  • Completed

Environment

Mac
Brew
vale version 3.7.1

Describe the bug / provide steps to reproduce it

It seems that custom YAML Style files must have the extension *.yml.

This tripped me up for a while; my style file I had was a *.yaml.

Example

Given this config:

StylesPath = styles

[*.md]
BasedOnStyles = Hello

My vale ls-config:

$ vale ls-config
{
  "BlockIgnores": {},
  "Checks": null,
  "Formats": {},
  "Asciidoctor": {},
  "FormatToLang": {},
  "GBaseStyles": null,
  "GChecks": {},
  "IgnoredClasses": null,
  "IgnoredScopes": null,
  "MinAlertLevel": 1,
  "Vocab": null,
  "RuleToLevel": {},
  "SBaseStyles": {
    "*.md": [
      "Hello"
    ]
  },
  "SChecks": {
    "*.md": {}
  },
  "SkippedScopes": null,
  "Stylesheets": {},
  "TokenIgnores": {},
  "WordTemplate": "",
  "RootINI": "/Users/jlacher/workspace/test/.vale.ini",
  "Paths": [
    "/Users/jlacher/Library/Application Support/vale/styles",
    "/Users/jlacher/workspace/test/styles"
  ],
  "ConfigFiles": [
    "/Users/jlacher/workspace/test/.vale.ini"
  ],
  "NLPEndpoint": ""
}

My rule:

extends: substitution
message: Consider using '%s' instead of '%s'
level: warning
ignorecase: false
swap:
  hello: goodbye

With .yaml

With rule: styles/Hello/PreferedTerms.yaml

> vale test.md
✔ 0 errors, 0 warnings and 0 suggestions in 1 file.

With .yaml

With rule: styles/Hello/PreferedTerms.yml

> vale test.md

 test.md
 1:1  warning  Consider using 'goodbye'        Hello.PreferedTerms 
               instead of 'hello'                                  

✖ 0 errors, 1 warning and 0 suggestions in 1 file.

It couldn't find an existing issue for this, though surely someone else must have been in the same position as me.

It does seem like it would be useful to support both .yaml and .yml.

In RFC 9512 section 3.3 they do say:

The "yaml" filename extension is the preferred one; it is the most popular and widely used on the web. The "yml" filename extension is still used. The simultaneous usage of two filename extensions in the same context might cause interoperability issues (e.g., when both a "config.yaml" and a "config.yml" are present).

@jonathonlacher
Copy link
Author

Ah, it is mentioned in the docs.

Make sure your rule files end in extension .yml. Do not end them in .yaml, as Vale will not detect them.

@jonathonlacher
Copy link
Author

Is there an appetite to support .yaml extension? I haven't fully looked at the codebase, but is the current barrier that it's just hard coded to look for .yml?

Like here for example:

path := filepath.Join(cfg.StylesPath(), name[0], name[1]+".yml")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant