pradurg/kirtimukh

View on GitHub

Showing 7 of 55 total issues

Method initialize has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void initialize(final Bootstrap<AppConfig> bootstrap) {
        bootstrap.addBundle(new ThrottlingBundle<AppConfig, ThrottlingKeyType>() {
            @Override
            protected ThrottlingBundleConfiguration getThrottlingConfiguration(AppConfig appConfig) {
Severity: Major
Found in demo/src/main/java/io/durg/kirtimukh/dw/demo/App.java - About 6 hrs to fix

    App has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class App extends Application<AppConfig> {
        @Override
        public void initialize(final Bootstrap<AppConfig> bootstrap) {
            bootstrap.addBundle(new ThrottlingBundle<AppConfig, ThrottlingKeyType>() {
                @Override
    Severity: Minor
    Found in demo/src/main/java/io/durg/kirtimukh/dw/demo/App.java - About 2 hrs to fix

      Method createTraceable has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private static <R> HystrixCommand<R> createTraceable(final HystrixCommand.Setter setter,
                                                               final String traceId,
                                                               final HystrixCommandExecutor<R> executor) {
      
              return new HystrixCommand<R>(setter) {

      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 createTraceable has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static <R> HystrixCommand<R> createTraceable(final HystrixCommand.Setter setter,
                                                               final String traceId,
                                                               final HystrixCommandExecutor<R> executor) {
      
              return new HystrixCommand<R>(setter) {

        Method getStrategyChecker has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private StrategyChecker getStrategyChecker(final ThrottlingKey bucketKey) {
                final String configKey = bucketKey.getConfigName();
        
                ThrottlingStrategyType strategyType = strategyTypeMap.getOrDefault(configKey,
                        defaultStrategyConfig.getType());

          Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                      @Override
                      protected R run() throws Exception {
                          Scope scope = null;
                          if (parentMDCContext != null) {
                              MDC.setContextMap(parentMDCContext);

          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 initialise has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public void initialise(final ThrottlingStrategyConfig defaultConfig,
                                     final Map<String, ThrottlingStrategyConfig> commandConfigs,
                                     final CustomThrottlingController customThrottlingController,
                                     final ThrottlingExceptionTranslator<? extends RuntimeException> exceptionTranslator,
                                     final MetricRegistry metricRegistry) {
          Severity: Minor
          Found in core/src/main/java/io/durg/kirtimukh/throttling/ThrottlingManager.java - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language