UiPath.CLI.Windows package analyze needs better rules configuration

When running UiPath.CLI.Windows package analyze, there should be a way to include a RulesConfig.json file to customize the way that errors, warnings, etc are treated in the analysis.

The option to exclude a list of rules (entirely) does exist, but anything more nuanced or specific isn’t.

I’ve been spending some serious time with the most up-to-date version of the UiPath.CLI.Windows, so here is some additional feedback about Package Analyze:

–analyzerTraceLevel doesn’t seem to do anything except set all of the discovered (non-info) ‘violations’ to the ErrorSeverity level specified.
For example, --analyzerTraceLevel ‘Verbose’ would set all rule violations to ErrorSeverity 4. Running the exact same analysis with --analyzerTraceLevel ‘Error’ would set all of the 4’s from the previous example 1.

Rule ST-USG-034 (Automation Hub URL) reports a violation even when there is a valid URL in the project.json file.

With all of these limitations, using --stopOnRuleViolation in a build pipeline isn’t an effective solution (but I really wish that it were, so I’m hoping someone reads this feedback).

Where did you find details of this package Peter?

I had not heard of it but its in the official UiPath feed not listed as preview…
I cannot use it myself as various dependencies within it apparently cannot be found in any feed.

Things like the UiPath.Workflow.StandaloneAnalyzer is something I say as part of the build pipeline packages but its not appearing as a nuget for me.

Very odd, but I’d love more info as I recently made myself a nugest package as a wrapper for the CLI to analyze projects with custom rulesets etc but wanted to try to leverage some better functionality than the basic CLI stuff.

image

Hi, @Jon_Smith
I’d be happy to tell you more about how I’ve been using UiPath.CLI.Windows
First, I wasn’t getting the expected behavior when I used the Azure DevOps task plugin, so I’ve added a couple of tasks in my pipeline that:

  1. Registers the UiPath-Official feed (Register-PSResourceRepository).
  2. Downloads the latest UiPath.CLI.Windows (Save-PSResource)
  3. Get the directory location for the ‘tools’ folder in the saved resource
  4. Publishes the CLI files to an artifact that can be used in future pipeline jobs as needed.

Something to note here is that Save-PSResource downloads the unpacked CLI files, so it comes with all of its dependencies included. I’ve never had any problem using it directly from the cmd either on my local machine or in a pipeline task.

  - pwsh: |
      $cliName = 'UiPath.CLI.Windows'
      $uipFeed = 'UiPath-Official'
      $uipFeedUri = 'https://pkgs.dev.azure.com/uipath/Public.Feeds/_packaging/UiPath-Official/nuget/v3/index.json'
      Register-PSResourceRepository -Name $uipFeed -Uri $uipFeedUri -Trusted -Priority 90 -Force
      Save-PSResource -Name $cliName -Repository $uipFeed -Path $(Pipeline.Workspace) -SkipDependencyCheck
      $cliFolder = (Get-ChildItem -Path "$(Pipeline.Workspace)\$(cliName)" ).FullName + '\tools\'
      if (Test-Path -Path "$($cliFolder)uipcli.exe" ) {
        Write-Host "##vso[task.setvariable variable=cliFolder]$cliFolder"
        Write-Host "CLI path is $cliFolder"
      }
      else {
        Write-Host "UiPath.CLI did not download"
        Exit 1
      }
    displayName: Download UiPath CLI

  - task: CopyFiles@2
    inputs:
      SourceFolder: $(cliFolder)
      Contents: '**'
      TargetFolder: $(Build.ArtifactStagingDirectory)\Tools\$(cliName)
    displayName: Copy UiPath.CLI to Tools
    condition: succeeded()

  - task: PublishPipelineArtifact@1
    inputs:
      targetPath: $(Build.ArtifactStagingDirectory)\Tools
      artifact: Tools
      publishLocation: Pipeline
    displayName: Publish Tools
    condition: succeeded()

In later jobs, I use DownloadPipelineArtifact@2 with targetPath $(Pipeline.Workspace)\Tools, so the executable is $(Pipeline.Workspace)\Tools\$(cliName)\uipcli.exe.

I used these resources (and some trial and error) to figure out the CLI:
Automation Ops - UiPath CLI
Automation Ops - Executing Tasks (uipath.com)

I’d love to hear more about the wrapper that you created.
All the best, Peter