forked from nblockchain/conventions
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add not_respecting_some_naming_conventions.fsx script to detect if some naming conventions are respected. Fixes nblockchain#93
- Loading branch information
1 parent
9eb406d
commit 40691f8
Showing
12 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ jobs: | |
- name: Compile the conventions solution | ||
run: dotnet build --configuration Release conventions.sln | ||
- name: Compile F# scripts | ||
run: dotnet fsi scripts/compileFSharpScripts.fsx | ||
run: dotnet fsi scripts/compile_fsharp_scripts.fsx | ||
|
||
file-conventions-tests: | ||
name: Run FileConventions-lib unit tests | ||
|
@@ -150,22 +150,24 @@ jobs: | |
apt install --yes --no-install-recommends dotnet6 | ||
- name: Check all files end with EOL | ||
run: dotnet fsi scripts/eofConvention.fsx | ||
run: dotnet fsi scripts/eof_convention.fsx | ||
- name: Check all .fsx scripts have shebang | ||
run: dotnet fsi scripts/shebangConvention.fsx | ||
run: dotnet fsi scripts/shebang_convention.fsx | ||
- name: Check there are no mixed line-endings in any files | ||
run: dotnet fsi scripts/mixedLineEndings.fsx | ||
run: dotnet fsi scripts/mixed_line_endings.fsx | ||
- name: Check there are no unpinned GitHubActions image versions | ||
run: dotnet fsi scripts/unpinnedGitHubActionsImageVersions.fsx | ||
run: dotnet fsi scripts/unpinned_github_actions_image_versions.fsx | ||
- name: Check there are no unpinned dotnet package versions | ||
run: dotnet fsi scripts/unpinnedDotnetPackageVersions.fsx | ||
run: dotnet fsi scripts/unpinned_dotnet_package_versions.fsx | ||
- name: Check there are no unpinned nuget package reference versions in F# scripts | ||
run: dotnet fsi scripts/unpinnedNugetPackageReferenceVersions.fsx | ||
run: dotnet fsi scripts/unpinned_nuget_package_reference_versions.fsx | ||
- name: Check there are no unpinned versions in `dotnet tool install` commands | ||
run: dotnet fsi scripts/unpinnedDotnetToolInstallVersions.fsx | ||
- name: Check if gitPush1by1 was used | ||
run: dotnet fsi scripts/unpinned_dotnet_tool_install_versions.fsx | ||
- name: Check if script names (.fsx, .bat, and .sh files) are snake_case and CI job names are kebab-case. | ||
run: dotnet fsi scripts/not_respecting_some_naming_conventions.fsx | ||
- name: Check if git_push_1by1 was used | ||
if: github.event_name == 'pull_request' | ||
run: dotnet fsi scripts/detectNotUsingGitPush1by1.fsx | ||
run: dotnet fsi scripts/detect_not_using_git_push_1by1.fsx | ||
- name: Install prettier | ||
run: npm install [email protected] | ||
- name: Change file permissions | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env -S dotnet fsi | ||
|
||
open System | ||
open System.IO | ||
|
||
#r "nuget: YamlDotNet, Version=13.0.2" | ||
#load "../src/FileConventions/Library.fs" | ||
#load "../src/FileConventions/Helpers.fs" | ||
|
||
let rootDir = Path.Combine(__SOURCE_DIRECTORY__, "..") |> DirectoryInfo | ||
|
||
let invalidYmlFiles = | ||
Helpers.GetInvalidFiles | ||
rootDir | ||
"*.yml" | ||
FileConventions.DetectNotUsingKebabCaseInGitHubCIJobs | ||
|
||
Helpers.AssertNoInvalidFiles | ||
invalidYmlFiles | ||
"Please use kebab-case for CI job names in the following files:" | ||
|
||
let scriptExtensions = | ||
seq { | ||
".fsx" | ||
".bat" | ||
".sh" | ||
} | ||
|
||
let scriptsWithInvalidNames = | ||
scriptExtensions | ||
|> Seq.map(fun extension -> | ||
Helpers.GetInvalidFiles | ||
rootDir | ||
("*" + extension) | ||
FileConventions.DetectNotUsingSnakeCaseInScriptName | ||
) | ||
|> Seq.concat | ||
|
||
Helpers.AssertNoInvalidFiles | ||
scriptsWithInvalidNames | ||
"Please use snake_case for naming the following scripts:" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.