melphi/algobox

View on GitHub

Showing 161 of 255 total issues

Function marked has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function marked(src, opt, callback) {
  if (callback || typeof opt === 'function') {
    if (!callback) {
      callback = opt;
      opt = null;

    PriceOhlcCacheMdb has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public final class PriceOhlcCacheMdb implements Ohlc {
      public static final String COLLECTION_PRICE_OHLC_CACHE = "priceOhlcCache";
      public static final String FIELD_INSTRUMENT = "instrument";
      public static final String FIELD_FROM_TIME = "fromTime";
      public static final String FIELD_TO_TIME = "toTime";

      Consider simplifying this complex logical expression.
      Open

                      if (match) {
                          // parse months, days, hours, minutes, seconds, and milliseconds
                          // provide default values if necessary
                          // parse the UTC offset component
                          var year = $Number(match[1]),

        File plot.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from algobox.analysis.indicator import OhlcIndicators
        from algobox.price import StandardTimeFrame
        from algobox.price.pricefactory import PriceFactory
        from algobox.util.preconditions import Preconditions
        from datetime import datetime
        Severity: Minor
        Found in python/algobox/src/algobox/analysis/plot.py - About 2 hrs to fix

          Function toFixed has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var toFixedShim = function toFixed(fractionDigits) {
                  var f, x, s, m, e, z, j, k;
          
                  // Test for NaN and round fractionDigits down
                  f = $Number(fractionDigits);

            Function splice has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    splice: function splice(start, deleteCount) {
                        var O = ES.ToObject(this);
                        var A = [];
                        var len = ES.ToUint32(O.length);
                        var relativeStart = ES.ToInteger(start);

              Function split has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          StringPrototype.split = function (separator, limit) {
                              var string = String(this);
                              if (typeof separator === 'undefined' && limit === 0) {
                                  return [];
                              }

                ConnectorServiceImpl has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public final class ConnectorServiceImpl implements ConnectorService {
                  private static final Logger LOGGER = LoggerFactory.getLogger(ConnectorServiceImpl.class);
                  private static final long TRY_CONNECTION_POLLING_MILLISECONDS = 1_500L;
                  private static final long MARKET_HOURS_POLLING_MILLISECONDS = 60_000L;
                
                

                  Function onOAuthComplete has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
                    if(token) {
                      if(token.error) {
                        var checkbox = $('input[type=checkbox],.secured')
                        checkbox.each(function(pos){

                    Method getMarketHours24HoursMarket has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public static Optional<MarketHours> getMarketHours24HoursMarket(
                          InstrumentInfoDetailed info, ZonedDateTime localDateTime) {
                        checkArgument(localDateTime.getZone().getId().equals(info.getTimeZoneId()));
                        checkArgument(Objects.equals(info.getOpenHour(), info.getCloseHour()) &&
                                Objects.equals(info.getOpenMinute(), info.getCloseMinute()),

                      Function setupParams has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            setupParams: function setupParams(helper, paramSize, params) {
                              var options = {},
                                  contexts = [],
                                  types = [],
                                  ids = [],

                        Function mergeSource has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              mergeSource: function mergeSource(varDeclarations) {
                                var isSimple = this.environment.isSimple,
                                    appendOnly = !this.forceBuffer,
                                    appendFirst = undefined,
                                    sourceSeen = undefined,

                          Consider simplifying this complex logical expression.
                          Open

                                              if (
                                                  hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) &&
                                                  minute < 60 && second < 60 && millisecond < 1000 &&
                                                  month > -1 && month < 12 && hourOffset < 24 &&
                                                  minuteOffset < 60 && // detect invalid offsets

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

                                @Override
                                public void run() {
                                  // TODO(robertom): Implement service shutdown hook.
                                  while (true) {
                                    ImmutableSet<String> connectorsId = ImmutableSet.copyOf(keepAliveConnections);

                            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 equals has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                              @Override
                              public boolean equals(Object o) {
                                if (this == o) {
                                  return true;
                                }
                            Severity: Minor
                            Found in java/algobox/algobox-core/src/main/java/io/algobox/order/Order.java - About 1 hr to fix

                            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

                            Function next has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                            next: function next() {
                                                if (this.done) {
                                                    return this.EOF;
                                                }
                                                if (!this._input) this.done = true;

                              Method registerStrategy has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                private String registerStrategy(StrategyRegistration registration) {
                                  Class<? extends Strategy> strategyClass =
                                      strategyManager.getStrategyById(registration.getStrategyId());
                                  checkNotNull(strategyClass, String.format(
                                      "Strategy [%s] is not registered.", registration.getStrategyId()));

                                Function parse has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            var parseShim = function parse(string) {
                                                var match = isoDateExpression.exec(string);
                                                if (match) {
                                                    // parse months, days, hours, minutes, seconds, and milliseconds
                                                    // provide default values if necessary

                                  Method loadStrategies has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    @SuppressWarnings("unchecked")
                                    private Map<String, Class<? extends Strategy>> loadStrategies(
                                        String strategiesJarPath, boolean loadDummyByDefault) throws Exception {
                                      checkArgument(strategiesJarPath.startsWith("/"),
                                          String.format("Strategies jar folder [%s] should start with /.", strategiesJarPath));

                                    Function PartialBlockStatement has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) {
                                          this.accept(block.program);
                                          this.accept(block.inverse);
                                    
                                          // Find the inverse program that is involed with whitespace stripping.
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language