Commit graph

43 commits

Author SHA1 Message Date
xtqqczze 883ca98dd7
Seal private classes (#15725)
* Seal private classes

* Fix CS0509

* Fix CS0628
2021-07-19 14:09:12 +05:00
xtqqczze edb70b1992
Fix IDE0090: Simplify new expression part 4.5 (#14259)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090
2020-11-27 08:17:15 +05:00
xtqqczze d5b0264374
Use consistent spacing in xml documentation tags (#14231) 2020-11-25 22:58:52 +05:00
xtqqczze 0d1ea73e59
Enable IDE0074: Use coalesce compound assignment (#13396)
* Autofix IDE0074: Use compound assignment
2020-11-25 17:37:01 +05:00
xtqqczze 0db5e8f3c9
Fix various xml documentation issues (#14223)
* Use correct paramref tag

* End summary tag in correct position

* Escape generic identifiers correctly

* https://github.com/DotNetAnalyzers/DocumentationAnalyzers/blob/master/docs/DOC202.md

* Remove extraneous space
2020-11-23 14:07:48 +05:00
xtqqczze 1d7a93c2e0
Enable CA1825: Avoid zero-length array allocations (#13961) 2020-11-04 08:56:26 +05:00
James Truher [MSFT] f8b9e8e9db
Create warnings when UTF7 is specified as an encoding (#13430) 2020-08-17 22:19:22 -07:00
Dongbo Wang 4b9b0788ed
Revert "Use is null syntax (#13277)" (#13322)
This reverts commit 6c03776d74.
2020-07-30 16:06:38 -07:00
xtqqczze 6c03776d74
Use is null syntax (#13277)
Replace `== null` with `is null`
2020-07-30 18:04:03 +05:00
Steve Lee b7cb335f03
Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
xtqqczze a34d0f3e80
Reformat code according to EditorConfig rules (#11681) 2020-01-31 14:56:22 -08:00
David Smatlak 3923ca1728 Fixes FWLinks for PS7 online help documents (#11071) 2019-12-02 10:25:56 -08:00
Ilya ff37337f95 Add Culture parameter to Select-String cmdlet (#10943) 2019-11-15 17:07:39 -08:00
Steve Lee 4ff9924cbf Add $env:__SuppressAnsiEscapeSequences to control whether to… (#10814) 2019-10-24 12:45:26 -07:00
Derek Xia 4a4dc4c751 Adds emphasis to Select-String default formatter (#8963) 2019-10-08 16:11:10 -07:00
Jos Koelewijn 48c7e112db Add -Raw switch to Select-String for convenience (#9901) 2019-07-19 13:21:39 -07:00
Christoph Bergmeister [MVP] fe56f9d902 Upgrade .Net Core 3 SDK from preview5 to preview6 and related out of band Nuget packages from 2.1 to 3.0-preview6 (#9888) 2019-07-09 14:35:08 -07:00
Ilya 50efc4192d
Run CodeFormatter for Utility module (#9376) 2019-04-17 17:42:03 +05:00
Ilya 767c13fca1
Style: Remove extra spaces after <para> and before </para> docs tags (#8547) 2018-12-28 11:05:14 +05:00
Ilya 871ce5696d
Style: Add period before returns doc tag (#8535)
- add period before "</returns>" doc tag
- remove extra space before "</returns>" doc tag
- convert first char after "<returns>" doc tag to upper case
2018-12-25 21:43:03 +05:00
Staffan Gustafsson 9c4340ab25 Make Select-String faster by not doing extra work (#7673)
By not tracking context in the common case where Context size is 0 (using new NoContextTracker class), and by not checking if the full name of a FileInfo is a Directory, about 30% of the execution time is cut when piping files into Select-String.
2018-10-18 09:46:07 +05:00
ThreeFive-O 4e98f244fd Add unified attribute for completion for Encoding parameter. (#7732)
Provide a tab completion attribute (ArgumentEncodingCompletionsAttribute) for an Encoding parameter.
This PR should fix the duplicated code warning in CodeFactor
2018-09-11 09:26:12 +05:00
Ilya e9d5f68ba5 Format Utility csproj with updated codeformatter (#7263)
Related #4708.

Format Microsoft.PowerShell.Commands.Utility.csproj by codeformatter with default options.

The codeformatter is used that I compiled with newest Roslyn packages (version 2.8.2).
2018-07-20 18:51:13 -07:00
Ilya a3786158ca
Fix docs comments in utility folder (#7192) 2018-07-17 10:07:16 +05:00
Ilya b1a525923a
Remove dummy comments in Utility module files (#7224)
* Remove dummy comments (like } // dummy ) in Utility module files
* Fix new line at eof.
2018-07-06 13:50:13 +05:00
Ilya e177fcaef6 CodeFactor code style cleanup: replace literal empty strings with 'string.Empty' (#6950) 2018-06-12 12:30:10 -07:00
PRASOON KARUNAN V ec678be4f4 Implementation of -lp alias for -LiteralPath variable #6732 (#6770)
Implementation of -lp alias for -LiteralPath variable for issue #6732 

Add-Content 

Add-Type 

Clear-Content 

Clear-Item 

Clear-ItemProperty 

Convert-Path 

Copy-Item 

Export-Alias 

Export-Clixml 

Export-Csv 

Export-FormatData 

Format-Hex 

Get-ChildItem 

Get-Content 

Get-FileHash 

Get-Item 

Get-ItemProperty 

Get-ItemPropertyValue 

Import-Alias 

Import-Clixml 

Import-Csv 

Import-PowerShellDataFile 

Move-Item 

Out-File 

Push-Location 

Remove-Item 

Rename-Item 

Resolve-Path 

Select-String 

Select-Xml 

Set-Content 

Set-Item 

Set-ItemProperty 

Set-Location 

Split-Path 

Start-Job 

Start-Transcript 

Tee-Object 

Test-Path 

Unblock-File
2018-05-03 14:22:48 -07:00
Steve Lee c1c5344a88 Update copyright and license headers (#6134)
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files.

Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks.

Separate PR coming to update contribution document for new source files: #6140

Manually reviewed each change.

Fix #6073
2018-02-13 09:23:53 -08:00
Steve Lee 4bc52d2358 Use consistent '(c)' for copyright symbol (#5210)
- Remove the year about copyright
- Fix casing of `All rights reserved`
- Replace Unicode characters representing single quote with a single quote
2017-10-26 14:12:19 -07:00
James Truher [MSFT] be700729d6 Unify cmdlets with parameter 'Encoding' to be of type System.Text.Encoding (#5080)
This unifies file encoding across the inbox cmdlets to be UTF-8 without a BOM for all platforms. This is a breaking change as cmdlets on windows have a number of different encodings. This supports better interoperability with tradition Linux shells as we are using the same encoding.

Validate that files are created with UTF-8 encoding without BOM
Update tests to validate Encoding parameter to new type and create new tests for
parameter type validation.

[Breaking Change] The '-Encoding Byte' has been removed from the filesystem provider cmdlets. A new parameter '-AsByteStream' is now added to indicate that a byte stream is required as input, or output will be a stream of bytes.
2017-10-23 19:46:27 -07:00
Dominic 81c46c6e51 Fix MatchInfoContext clone implementation (#5121)
The old implementation always set the new object's properties to null.
2017-10-17 20:53:29 -07:00
Ilya a4cdb806f4 Exclude directories discovered from '-Path' in Select-String (#4829)
Select-String can search in files only so we should skip directories.
2017-09-14 14:57:17 -07:00
Dongbo Wang 7a55bf98b2 Move powershell to .NET Core 2.0 (#3556)
This change moves powershell to .NET Core 2.0. Major changes are:
1. PowerShell assemblies are now targeting `netcoreapp2.0`. We are using `microsoft.netcore.app-2.0.0-preview1-001913-00`, which is from dotnet-core build 4/4/17. We cannot target `netstandard2.0` because the packages `System.Reflection.Emit` and `System.Reflection.Emit.Lightweight`, which are needed for powershell class, cannot be referenced when targeting `netstandard2.0`.
2. Refactor code to remove most CLR stub types and extension types.
3. Update build scripts to enable CI builds. The `-cache` section is specified to depend on `appveyor.yml`, so the cache will be invalidated if `appveyor.yml` is changed.
4. Ship `netcoreapp` reference assemblies with powershell to fix the issues in `Add-Type` (#2764). By default `Add-Type` will reference all those reference assemblies when compiling C# code. If `-ReferenceAssembly` is specified, then we search reference assemblies first, then the framework runtime assemblies, and lastly the loaded assemblies (possibly a third-party one that was already loaded).
5. `dotnet publish` generates executable on Unix platforms, but doesn't set "x" permission and thus it cannot execute. Currently, the "x" permission is set in the build script, `dotnet/cli` issue [#6286](https://github.com/dotnet/cli/issues/6286) is tracking this.
6. Replace the use of some APIs with the ones that take `SecureString`.
7. osx.10.12 is required to update to `netcoreapp2.0` because `dotnet-cli` 2.0.0-preview only works on osx.10.12.
8. Add dependency to `System.ValueTuple` to work around a ambiguous type identity issue in coreclr. The issue is tracked by `dotnet/corefx` [#17797](https://github.com/dotnet/corefx/issues/17797). When moving to newer version of `netcoreapp2.0`, we need to verify if this dependency is still needed.
2017-04-17 11:52:38 -07:00
Jason Shirk 02b5f357a2 Remove trailing whitespace (#3001) 2017-01-16 13:31:14 -08:00
iSazonov d543195bd4 Fix Verbs<> class strings #2716 (#2762)
* Fix Verbs
* Replace `-runspace` with `-Session`
2016-11-23 09:19:15 -08:00
Dongbo Wang 58a2ba730d Merge pull request #2046 from xiaoyinl/use-https-links
Use HTTPS links for go.microsoft.com
2016-09-01 17:23:09 -07:00
Josh Soref eb3fd7ae6c Spelling comments (#2066)
* spelling: comments in src/Microsoft.Management.Infrastructure.CimCmdlets

* spelling: comments in src/Microsoft.PackageManagement.ArchiverProviders

* spelling: comments in src/Microsoft.PackageManagement.CoreProviders

* spelling: comments in src/Microsoft.PackageManagement.MetaProvider.PowerShell

* spelling: comments in src/Microsoft.PackageManagement.MsiProvider

* spelling: comments in src/Microsoft.PackageManagement.MsuProvider

* spelling: comments in src/Microsoft.PackageManagement.NuGetProvider

* spelling: comments in src/Microsoft.PackageManagement.PackageSourceListProvider

* spelling: comments in src/Microsoft.PackageManagement

* spelling: comments in src/Microsoft.PowerShell.Activities

* spelling: comments in src/Microsoft.PowerShell.Commands.Diagnostics

* spelling: comments in src/Microsoft.PowerShell.Commands.Management

* spelling: comments in src/Microsoft.PowerShell.Commands.Utility

* spelling: comments in src/Microsoft.PowerShell.ConsoleHost

* spelling: comments in src/Microsoft.PowerShell.Core.Activities

* spelling: comments in src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext

* spelling: comments in src/Microsoft.PowerShell.CoreCLR.Eventing

* spelling: comments in src/Microsoft.PowerShell.Diagnostics.Activities

* spelling: comments in src/Microsoft.PowerShell.GraphicalHost

* spelling: comments in src/Microsoft.PowerShell.LocalAccounts

* spelling: comments in src/Microsoft.PowerShell.Management.Activities

* spelling: comments in src/Microsoft.PowerShell.PSReadLine

* spelling: comments in src/Microsoft.PowerShell.PackageManagement

* spelling: comments in src/Microsoft.PowerShell.ScheduledJob

* spelling: comments in src/Microsoft.PowerShell.Security.Activities

* spelling: comments in src/Microsoft.PowerShell.Security

* spelling: comments in src/Microsoft.PowerShell.Utility.Activities

* spelling: comments in src/Microsoft.PowerShell.Workflow.ServiceCore

* spelling: comments in src/Microsoft.WSMan.Management.Activities

* spelling: comments in src/Modules

* spelling: comments in src/Schemas

* spelling: comments in src/libpsl-native

* spelling: comments in src/powershell-native

* spelling: comments in build.psm1

* spelling: comments in src/System.Management.Automation/CoreCLR

* spelling: comments in src/System.Management.Automation/DscSupport

* spelling: comments in src/System.Management.Automation/cimSupport

* spelling: comments in src/System.Management.Automation/commands

* spelling: comments in src/System.Management.Automation/engine/Modules
2016-08-26 13:46:03 -07:00
xiaoyinl f538eeb416 Use HTTPS links for go.microsoft.com
I replace all occurrences of http://go.microsoft.com with https://go.microsoft.com in text files.
2016-08-23 21:21:31 -04:00
PowerShell Team 22d2273ce4 Refactoring - use ?? in more places 2016-08-03 12:14:28 -07:00
PowerShell Team ae8d2ed794 Refactor - convert to auto-property
Mostly using R# to automatically refactor, with some manual
fixups where it wouldn't work automatically (e.g. xml comments
on fields) or some it seemed to miss.

Some minor code reformatting was also done on properties near
other stuff I was manually inspecting.
2016-08-03 12:14:28 -07:00
PowerShell Team 403ae3f53f Initial run of code formatter
I (Jason Shirk) ran https://github.com/dotnet/codeformatter with the default rules, basically:

    codeformatter /nocopyright "/c:DEBUG,UNIX,CORECLR" @files.rsp

This caused a few problems building, which were fixed up manually.

Notable changes:

`this.` is removed unless needed to disambiguate.
private instance fields are renamed to have a `_` prefix.
private static fields are renamed to have a `s_` prefix.

I left some projects alone (like PackageManagement) and also left some generated code alone.
2016-08-01 15:57:03 -07:00
Andrew Schwartzmeyer 0f04de1e96 Fix some documentation warnings
Mostly low-hanging fruit and Linux additions/changes.
2016-07-18 19:08:28 -07:00
PowerShell Team 60b3b304f2 Move files from psl-monad submodule to super-project
This commit uses psl-monad branch source-depot 7209cb9
And corresponds to [SD:688741]
2016-03-30 17:16:23 -07:00