freshli-lib icon indicating copy to clipboard operation
freshli-lib copied to clipboard

Exception when running against getredash/redash

Open mscottford opened this issue 5 years ago • 1 comments

I suspect this is similar to #20 and #15, but perhaps is just it showing up in the recently added Python support.

using XPlot.Plotly;

using Freshli;
using Freshli.Languages.Ruby;
using Freshli.Languages.Php;
using Freshli.Languages.Python;

ManifestFinder.Register<RubyBundlerManifestFinder>();
ManifestFinder.Register<PhpComposerManifestFinder>();
ManifestFinder.Register<PipRequirementsTxtManifestFinder>();

FileHistoryFinder.Register<GitFileHistoryFinder>();

var runner = new Runner();

var projects = new Dictionary<string, IList<MetricsResult>>();
projects["redash"] = runner.Run("https://github.com/getredash/redash");

Generates the following exception:

System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at Freshli.Languages.Python.PyPIRepository.Latest(String name, String thatMatches, DateTime asOf)
   at Freshli.LibYearCalculator.ComputeAsOf(DateTime date)
   at Freshli.Runner.Run(String analysisPath, DateTime asOf)
   at Freshli.Runner.Run(String analysisPath)
   at Submission#7.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at Freshli.Languages.Python.PyPIRepository.Latest(String name, String thatMatches, DateTime asOf)
   at Freshli.LibYearCalculator.ComputeAsOf(DateTime date)
   at Freshli.Runner.Run(String analysisPath, DateTime asOf)
   at Freshli.Runner.Run(String analysisPath)
   at Submission#7.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)

mscottford avatar Jun 10 '20 16:06 mscottford

I successfully re-ran using the latest code.

A minor issue remains - starting in June, 2019, the following comment was added to requirements.txt:

# Install the dependencies of the bin/bundle-extensions script here.
# It has its own requirements file to simplify the frontend client build process
-r requirements_bundles.txt
# Uncomment the requirement for ldap3 if using ldap.
# It is not included by default because of the GPL license conflict.
# ldap3==2.2.4

The manifest parser does not recognize

-r requirements_bundles.txt

as a comment and tries unsuccessfully to parse it, resulting in a number of Skipping -r: Unable to find latest version of -r warnings.

nickiemc avatar Sep 02 '20 20:09 nickiemc