diff --git a/src/FileConventions.Test/DummyFiles/DummyCIWithNonVerboseFlag.yml b/src/FileConventions.Test/DummyFiles/DummyCIWithNonVerboseFlag.yml new file mode 100644 index 000000000..d06a1c9b8 --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyCIWithNonVerboseFlag.yml @@ -0,0 +1,11 @@ +name: CI + +on: [push, pull_request] + +jobs: + file-conventions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Print apt version + run: apt -v diff --git a/src/FileConventions.Test/DummyFiles/DummyCIWithoutNonVerboseFlags.yml b/src/FileConventions.Test/DummyFiles/DummyCIWithoutNonVerboseFlags.yml new file mode 100644 index 000000000..d8efcfc1d --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyCIWithoutNonVerboseFlags.yml @@ -0,0 +1,11 @@ +name: CI + +on: [push, pull_request] + +jobs: + file-conventions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Print apt version + run: apt --version diff --git a/src/FileConventions.Test/FileConventions.Test.fs b/src/FileConventions.Test/FileConventions.Test.fs index ec5198f1e..84c7b4322 100644 --- a/src/FileConventions.Test/FileConventions.Test.fs +++ b/src/FileConventions.Test/FileConventions.Test.fs @@ -255,3 +255,29 @@ let HasBinaryContentTest3() = )) Assert.That(HasBinaryContent fileInfo, Is.EqualTo false) + + +[] +let NonVerboseFlagsInGitHubCI1() = + let fileInfo = + (FileInfo( + Path.Combine( + dummyFilesDirectory.FullName, + "DummyCIWithNonVerboseFlag.yml" + ) + )) + + Assert.That(NonVerboseFlagsInGitHubCI fileInfo, Is.EqualTo true) + + +[] +let NonVerboseFlagsInGitHubCI2() = + let fileInfo = + (FileInfo( + Path.Combine( + dummyFilesDirectory.FullName, + "DummyCIWithoutNonVerboseFlags.yml" + ) + )) + + Assert.That(NonVerboseFlagsInGitHubCI fileInfo, Is.EqualTo false) diff --git a/src/FileConventions/Library.fs b/src/FileConventions/Library.fs index 185244059..d53b33791 100644 --- a/src/FileConventions/Library.fs +++ b/src/FileConventions/Library.fs @@ -104,3 +104,7 @@ let EolAtEof(fileInfo: FileInfo) = False else True + +let NonVerboseFlagsInGitHubCI(fileInfo: FileInfo) = + assert (fileInfo.FullName.EndsWith(".yml")) + false