PowerShell / DscResource.Tests

Common meta tests for PowerShell DSC resources repositories.
MIT License
51 stars 49 forks source link

Added function for checking lower case format for all keywords #346

Closed SSvilen closed 5 years ago

SSvilen commented 5 years ago

Pull Request (PR) description

I have allowed myself creating a new PSScriptAnalyzer function, which checks if all PowerShell keywords are in lower case.
I saw that there are checks for the most used keywords, but I decided to do one for all keywords. Let me know what you think.

This Pull Request (PR) fixes the following issues

Task list


This change is Reviewable

codecov-io commented 5 years ago

Codecov Report

Merging #346 into dev will increase coverage by <1%. The diff coverage is 88%.

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #346    +/-   ##
====================================
+ Coverage    79%    79%   +<1%     
====================================
  Files        12     12            
  Lines      1768   1776     +8     
  Branches      2      2            
====================================
+ Hits       1413   1420     +7     
- Misses      353    354     +1     
  Partials      2      2
johlju commented 5 years ago

I will help review this as soon as possible, but will be later in the week.

johlju commented 5 years ago

Awesome job @SSvilen! πŸ˜ƒ

johlju commented 5 years ago

@PlagueHO yes I can test those repos against this branch, think I do xWebAdministration too. Will report back during he day. :)

johlju commented 5 years ago

@SSvilen Thank you for this PR! This has already help me in my maintainer role! Keep these rules coming, please! πŸ˜„

I will resolve the below failing repos as soon as this PR is merged.

All others are not opted into Common Tests - Custom Script Analyzer Rules.

johlju commented 5 years ago

Created a script to loop through all repos https://gist.github.com/johlju/411dcea4703d2b6e47230661e1d00bad

In progress running through all repos. WIll update list above accordingly.

johlju commented 5 years ago

All the repos have been tested. The list have been updated. I didn't bother enter those that passed. I just added SharePointDsc as that one is a bit important.

@PlagueHO If you merge this PR tonight (my time) I will start fixing all repos tomorrow. I rather have this PR merged so I know I don't miss any change when I merged a PR in the other repos.

/cc @gaelcolas

PlagueHO commented 5 years ago

@johlju - I ran my DSCResource.Analysis over all modules in the DSC Resource Kit and the following are the ones which are opted in to 'Common Tests - Custom Script Analyzer Rules': image

ActiveDirectoryCSDsc ActiveDirectoryDsc CertificateDsc ComputerManagementDsc DFSDsc FileContentDsc FSRMDsc iSCSIDsc NetworkingDsc SecurityPolicyDsc SqlServerDsc StorageDsc WmiNamespaceSecurityDsc WSManDsc xBitlocker xExchange xPSDesiredStateConfiguration xWebAdministration

So these are the only ones we need to worry about testing.

johlju commented 5 years ago

@SSvilen If you want to work on another rule, then space after a keyword would be great to get in, for example if( -> if (. Another I see often.

PlagueHO commented 5 years ago

Also after for/foreach/while too

johlju commented 5 years ago

Maybe all keywords that are followed by a space? πŸ€”

PlagueHO commented 5 years ago

Ok! Good work everyone - all repos have been updated to pass these new tests!

johlju commented 5 years ago

Cool! This rule will help a lot in future! πŸ˜ƒ