-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Lint: PSAvoidUsingCmdletAliases #2075
Lint: PSAvoidUsingCmdletAliases #2075
Conversation
Nice! Is there a way to enforce it by adding it to the tests? |
@r15ch13 The official PowerShell script linter is the PSScriptAnalyzer, currently we could use it through:
But the PSScriptAnalyzer is still problematic, some rules are false positive. e.g. PSUseDeclaredVarsMoreThanAssignment. It seems that PowerShell script linting toolchain remain to be perfected, but of course, the automatic linting and tests should be improved. Here I just give a prompt to set the ball rolling. 😂 |
These changes make the code much easier to read and maintain. Can we add a lint check to our test suite, and/or build chain? |
Just a heads up (I am the community maintainer of PSScriptAnalyzer ): The next upcoming release of PSSA will have a |
Luke Sampson has proudly ignored Powershell Verb-Noun naming conventions. https://github.com/lukesampson/psutils/blob/master/README.md |
* Fix interpretation of response's status code to detect redirections * Improve documentation of virustotal subcommand - usage & configuration of virustotal_api_key - special parameter '*' to test all installed apps - make necessity of having a virustotal_api_key for --scan explicit - show that it's possible to check several packages at once * Never use virustotal_api_key to query if a package is safe The URL in the code wasn't an API end-point anyway. * Refactor logic to warn user about apps unknown to VirusTotal * Warn once when virustotal_api_key's absence prevents VirusTotal submission This is preparation for changes to come in the package submission logic. * Use API to submit download link to VirusTotal, rate limited in EAFP fashion This is a roundabout way to get the file to be scanned without having to download & upload it ourselves. Rate limiting is implemented using EAFP: if submission fails, we wait at least 60s before retrying at most once. * Color undecided VirusTotal information the same way as `dangerous' files If the scanning is still in progress, VirusTotal returns 0 malicious, 0 suspicious and 0 undetected. Err on the safe side and color this the same way as `dangerous' files. * Remove requirement to only verify installed apps The initial use case for this feature was to scan packages to avoid installing dangerous apps. Assuming they are infected, we want if possible to avoid downloading them at all. * Check dependencies with VirusTotal, too (by default) * Manually apply `Lint: PSAvoidUsingCmdletAliases' (see e1bb1e9, #2075) This is to avoid conflicts when merging lukesampson:master * Explain applist's return value transformation: drop `global' flag for each app * Move variable declarations and apps list generation to the top * Reformat code and comply to linted function names * Reduce nesting, remove hacky hash/url retrieval * Remove $global variables * Fix regression bug in Search-VirusTotal() * Remove applist() because it's irrelevant if app is installed globally
Replace all cmdlet aliases with their full content.