Repository navigation
add warning codes with nowarn support for pack - #2013
Conversation
| else | ||
| { | ||
| var logMessage = message as IRestoreLogMessage; | ||
| var logMessage = message as INuGetLogMessage; |
| var logMessage = message as INuGetLogMessage; | ||
|
|
||
| if (logMessage == null) | ||
| { |
There was a problem hiding this comment.
Line below, GH is not allowing me to comment no parts that weren't edited.
If the message is null, then a RestoreLogMessage is created. Should be a more generic one?
There was a problem hiding this comment.
the only reason I let it stay is because I don't know why it would be null, but I was scared about breaking an existing code path. For packaging scenarios, I can guarantee it will never be null.
mishra14
left a comment
There was a problem hiding this comment.
small comments. Overall looks good! 🚀
| IncludeSymbols = includeSymbols; | ||
| } | ||
| public bool IncludeSymbols { get; set; } | ||
| public bool IncludeSymbols { get; set; } |
|
|
||
| IConsole console = Logger as IConsole; | ||
| if (console != null && console.Verbosity == Verbosity.Detailed) | ||
| Path.GetFileName(TargetPath)), NuGetLogCode.NU5011)); |
There was a problem hiding this comment.
you can keep a variable at top that is used as the error code. It will be more manageable.
| using Microsoft.VisualStudio; | ||
| using Microsoft.VisualStudio.Shell.Interop; | ||
| using NuGet.Commands; | ||
| using NuGet.Common; |
There was a problem hiding this comment.
doesn't look like this is being used.
There was a problem hiding this comment.
it is, related to the refactoring
| using Microsoft.Build.Framework; | ||
| using Microsoft.Build.Utilities; | ||
| using NuGet.Commands; | ||
| using NuGet.Common; |
There was a problem hiding this comment.
is it used? I dont see any other change in the class.
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using NuGet.Commands; | ||
| using NuGet.Common; |
| foreach (var file in builder.GetFiles()) | ||
| { | ||
| string name = Path.GetFileName(file); | ||
| string dirName = Path.GetFileName(Path.GetDirectoryName(file)); |
There was a problem hiding this comment.
var in the above 2 files?
| { | ||
| public IEnumerable<PackLogMessage> Validate(PackageArchiveReader builder) | ||
| { | ||
| foreach (var file in builder.GetFiles()) |
There was a problem hiding this comment.
You can replace the whole forloop as a linq query -
var initPs1Files = builder.GetFiles()
.Where(f => Path.GetFileName(file).Equals("init.ps1", StringComparison.OrdinalIgnoreCase))
.Where(f => Directory.GetParent(path).Name.Equals(PackagingConstants.Folders.Tools, StringComparison.OrdinalIgnoreCase))
.ForEach(f => yield return CreatePackageIssue(f));
| { | ||
| string path = file.Path; | ||
| string directory = Path.GetDirectoryName(path); | ||
| var directory = Path.GetDirectoryName(file); |
There was a problem hiding this comment.
Directory.GetParent(path).Name would be more accurate, but it may not make a difference since lib it at the top level in the structure.
There was a problem hiding this comment.
Directory.GetParent does actual disk I/O, so would be an expensive call here for doing just a string operation.
| else | ||
| { | ||
| string name = Path.GetFileNameWithoutExtension(path); | ||
| string name = Path.GetFileNameWithoutExtension(file); |
| using System.Text; | ||
| using System.Xml.Linq; | ||
| using NuGet.Commands; | ||
| using NuGet.Common; |
d5d0147 to
1efdcf1
Compare
…to handle packlogmessage
7c7ec3d to
19c864a
Compare
Fixes: NuGet/Home#6529
Adds support for
NoWarn,TreatWarningsAsErrorsandWarningsAsErrorsproperties in Pack that were only supported by restore until now. These properties also apply to packing nuspec if specified via thePropertiescommand line option.Will work on migrator rules and validation once this PR goes in.