Showing 71 of 215 total issues
Class ReflectionRepository
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
[InjectionInterface(typeof(IReflectionRepository))]
public class ReflectionRepository : IReflectionRepository
{
#region Constants
Class IReflectionRepository
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public interface IReflectionRepository
{
IEnumerable<string> GetSuites(Type type);
Class Logger
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class Logger
{
#region Repositories
Method Main
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static int Main(string[] args)
{
// hook up the event to unload repos on app exit
AppDomainRepository.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
Method RunTestFixtureCases
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
Open
private void RunTestFixtureCases(Type testFixture, IEnumerable<TestCaseAttribute> cases, int testFixtureRepeat, IEnumerable<MethodInfo> fixtureSetup, IEnumerable<MethodInfo> fixtureTeardown)
{
var activator = default(object);
var setupDone = false;
var testDone = false;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Validate
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void Validate(EdisonContext context)
{
// need to validate a solution first, for its assemblies
SolutionValidator(context);
Method RunTests
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void RunTests(Type testFixture, int testFixtureRepeat, TestCaseAttribute testFixtureCase, object activator)
{
var tests = ReflectionRepository.GetMethods<TestAttribute>(testFixture, Context.IncludedCategories, Context.ExcludedCategories, Context.Tests).ToList();
var singularTests = default(List<MethodInfo>);
Method Run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public TestResultDictionary Run()
{
//run validation first
Validate();
Method CheckExpectedException
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private bool CheckExpectedException(MethodInfo testMethod, bool isAssertFail, Exception innerException)
{
var expectedException = ReflectionRepository.GetExpectedException(testMethod);
if (expectedException == default(ExpectedExceptionAttribute)
Method InjectPropertyYamlValues
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static void InjectPropertyYamlValues(this object obj, Dictionary<object, object> yaml)
{
var keys = yaml.Keys.ToList();
var props = obj.GetType().GetProperties();
Method GetTestCount
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public int GetTestCount(
Assembly assembly,
IList<string> includedCategories,
IList<string> excludedCategories,
IList<string> fixtures,
Method AddOrUpdate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public bool AddOrUpdate(TestResult result)
{
var response = false;
var _result = default(TestResult);
var key = result.Assembly + "." + result.FullName;
Method HasValidCategories
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public bool HasValidCategories(MemberInfo member, IList<string> includedCategories, IList<string> excludedCategories, bool testFixtureDefault = true)
{
// if no categories are passed, just return true
if (EnumerableHelper.IsNullOrEmpty(includedCategories) && EnumerableHelper.IsNullOrEmpty(excludedCategories))
{
Method Run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void Run()
{
while (!(_interrupted && Count == 0))
{
// if there's nothing to send, sleep for a little
Method Get
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public dynamic Get(HtmlIdentifierType identifierType, string identifier)
{
if (Explorer.Document == null)
{
throw new NullReferenceException("Browser object has no Document available for querying");
Method SolutionValidator
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SolutionValidator(EdisonContext context)
{
// solution is optional, so if not passed skip validation
if (string.IsNullOrWhiteSpace(context.Solution))
{
Method GetParameters
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private string GetParameters(object[] parameters)
{
var _parameters = new StringBuilder();
// If there are no parameters, just return empty
Method EdisonContext_OnTestResult
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void EdisonContext_OnTestResult(ETestResult result)
{
switch (result.AbsoluteState)
{
case TestResultAbsoluteState.Ignored:
Method SetProgress
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SetProgress(int progress)
{
if (TestProgressBar.IsDisposed)
{
return;
Method WriteResultsToFile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void WriteResultsToFile()
{
if (DisableFileOutput)
{
Logger.Instance.WriteMessage("Output file creation disabled");