Skip to content

Commit

Permalink
Change id casing convention in blank template
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Mar 23, 2020
1 parent 963d1bd commit 3002376
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
/*.xcodeproj
xcuserdata/
/AnyLintTempTests
.codacy-coverage
*.lcov
codacy-coverage.json
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
### Added
- None.
### Changed
- None.
- Changed `CheckInfo` id casing convention from snake_case to UpperCamelCase in `blank` template.
Author: [Cihat Gündüz](https://github.com/Jeehut)
### Deprecated
- None.
### Removed
Expand Down
16 changes: 8 additions & 8 deletions Sources/AnyLintCLI/ConfigurationTemplates/BlankTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ enum BlankTemplate: ConfigurationTemplate {
let readmeFile: Regex = #"README\.md"#

// MARK: - Checks
// MARK: readme
// MARK: Readme
try Lint.checkFilePaths(
checkInfo: "readme: Each project should have a README.md file, explaining how to use or contribute to the project.",
checkInfo: "Readme: Each project should have a README.md file, explaining how to use or contribute to the project.",
regex: #"^README\.md$"#,
matchingExamples: ["README.md"],
nonMatchingExamples: ["README.markdown", "Readme.md", "ReadMe.md"],
violateIfNoMatchesFound: true
)

// MARK: readme_path
// MARK: ReadmePath
try Lint.checkFilePaths(
checkInfo: "readme_path: The README file should be named exactly `README.md`.",
checkInfo: "ReadmePath: The README file should be named exactly `README.md`.",
regex: #"^(.*/)?([Rr][Ee][Aa][Dd][Mm][Ee]\.markdown|readme\.md|Readme\.md|ReadMe\.md)$"#,
matchingExamples: ["README.markdown", "readme.md", "ReadMe.md"],
nonMatchingExamples: ["README.md", "CHANGELOG.md", "CONTRIBUTING.md", "api/help.md"],
Expand All @@ -33,9 +33,9 @@ enum BlankTemplate: ConfigurationTemplate {
]
)

// MARK: readme_top_level_title
// MARK: ReadmeTopLevelTitle
try Lint.checkFileContents(
checkInfo: "readme_top_level_title: The README.md file should only contain a single top level title.",
checkInfo: "ReadmeTopLevelTitle: The README.md file should only contain a single top level title.",
regex: #"(^|\n)#[^#](.*\n)*\n#[^#]"#,
matchingExamples: [
"""
Expand All @@ -60,9 +60,9 @@ enum BlankTemplate: ConfigurationTemplate {
includeFilters: [readmeFile]
)

// MARK: readme_typo_license
// MARK: ReadmeTypoLicense
try Lint.checkFileContents(
checkInfo: "readme_typo_license: Misspelled word 'license'.",
checkInfo: "ReadmeTypoLicense: Misspelled word 'license'.",
regex: #"([\s#]L|l)isence([\s\.,:;])"#,
matchingExamples: [" lisence:", "## Lisence\n"],
nonMatchingExamples: [" license:", "## License\n"],
Expand Down
14 changes: 0 additions & 14 deletions lint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,5 @@ try Lint.checkFileContents(
includeFilters: [readmeFile]
)

// MARK: ReadmeTypoLicense
try Lint.checkFileContents(
checkInfo: "ReadmeTypoLicense: Misspelled word 'license'.",
regex: #"([\s#]L|l)isence([\s\.,:;])"#,
matchingExamples: [" lisence:", "## Lisence\n"],
nonMatchingExamples: [" license:", "## License\n"],
includeFilters: [readmeFile],
autoCorrectReplacement: "$1icense$2",
autoCorrectExamples: [
AutoCorrection(before: " lisence:", after: " license:"),
AutoCorrection(before: "## Lisence\n", after: "## License\n"),
]
)

// MARK: - Log Summary & Exit
Lint.logSummaryAndExit()

0 comments on commit 3002376

Please sign in to comment.