melphi/algobox

View on GitHub

Showing 161 of 255 total issues

Function Program has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    WhitespaceControl.prototype.Program = function (program) {
      var doStandalone = !this.options.ignoreStandalone;

      var isRoot = !this.isRootSeen;
      this.isRootSeen = true;

    Method getMarketHoursLocalMarket has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static Optional<MarketHours> getMarketHoursLocalMarket(
          InstrumentInfoDetailed info, ZonedDateTime localDateTime) {
        checkArgument(localDateTime.getZone().getId().equals(info.getTimeZoneId()));
        ZonedDateTime previousDayDateTime = localDateTime.minusDays(1);
        switch (localDateTime.getDayOfWeek()) {

      Method tryEstablishConnection has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private boolean tryEstablishConnection() {
            if (!connectorManager.isMarketOpen()) {
              LOGGER.info(String.format("Market is not open, connection to [%s] skipped.", connectionId));
              callback.ifPresent(value -> value.complete(true));
              return true;

        Function bind has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                bind: function bind(that) { // .length is 1
                    // 1. Let Target be the this value.
                    var target = this;
                    // 2. If IsCallable(Target) is false, throw a TypeError exception.
                    if (!isCallable(target)) {

          Function compile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function compile(input, options, env) {
                if (options === undefined) options = {};
          
                if (input == null || typeof input !== 'string' && input.type !== 'Program') {
                  throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);

            Method createParameterValues has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private static Set<String> createParameterValues(ParameterValues values) {
                checkNotNull(values.getParameterValuesType());
                switch (values.getParameterValuesType()) {
                  case LIST:
                    checkNotNull(values.getValues(), "Parameter has null values.");

              Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, instrument_id, time_frame, timestamp_utc, open_ask,
              Severity: Major
              Found in python/algobox/src/algobox/price/domain.py - About 1 hr to fix

                Function prepareBlock has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
                      if (close && close.path) {
                        validateClose(openBlock, close);
                      }
                
                

                  Function reduceRight has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          reduceRight: function reduceRight(callbackfn/*, initial*/) {
                              var object = ES.ToObject(this);
                              var self = splitString && isString(this) ? strSplit(this, '') : object;
                              var length = ES.ToUint32(self.length);
                  
                  

                    Method createPriceOhlc has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private PriceOhlc createPriceOhlc(Iterable<PriceTick> priceTicks, String instrumentId) {
                        double openAsk = 0;
                        double openBid = 0;
                        double highAsk = 0;
                        double highBid = 0;

                      Method onPriceTick has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        @Override
                        public synchronized void onPriceTick(String source, PriceTick priceTick) {
                          List<Order> filledOrders = Lists.newArrayList();
                          List<Order> cancelledOrders = Lists.newArrayList();
                          for (Order order: activeOrders) {

                      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 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        @Override
                        public boolean equals(Object o) {
                          if (this == o) {
                            return true;
                          }

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

                              keys: function keys(object) {
                                  var isFn = isCallable(object);
                                  var isArgs = isArguments(object);
                                  var isObject = object !== null && typeof object === 'object';
                                  var isStr = isObject && isString(object);

                        Function pushParam has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              pushParam: function pushParam(val) {
                                var value = val.value != null ? val.value : val.original || '';
                        
                                if (this.stringParams) {
                                  if (value.replace) {

                          Function reduce has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  reduce: function reduce(callbackfn/*, initialValue*/) {
                                      var object = ES.ToObject(this);
                                      var self = splitString && isString(this) ? strSplit(this, '') : object;
                                      var length = ES.ToUint32(self.length);
                          
                          

                            Method onDisconnected has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Override
                                public void onDisconnected() {
                                  try {
                                    ConnectorPriceService priceService =
                                        connectorManager.getConnectionIfPresent(connectionId).getPriceService();

                              Method onConnected has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @Override
                                  public void onConnected() {
                                    LOGGER.info(String.format("Connector [%s] connected.", connectionId));
                                    try {
                                      ConnectorPriceService priceService =

                                Method messageArrived has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Override
                                    public void messageArrived(ISessionStatus iSessionStatus) {
                                      if (iSessionStatus instanceof GenericSessionStatus) {
                                        switch (iSessionStatus.getStatusCode()){
                                          case ISessionStatus.STATUSCODE_CONNECTING:

                                  Method createServer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private Undertow createServer() {
                                      ServletInfo holder = Servlets.servlet(JerseyApplication.class.getName(), ServletContainer.class)
                                          .setLoadOnStartup(0)
                                          .setAsyncSupported(true)
                                          .setEnabled(true)

                                    Method createOhlc has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                      private static PriceOhlc createOhlc(String instrumentId, double askOpen, double bidOpen,
                                          double askHigh, double bidHigh, double askLow, double bidLow, double askClose,
                                          double bidClose) {
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language