znamenica/dneslov

View on GitHub

Showing 99 of 2,171 total issues

Method convert_icon_links_into_images has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def convert_icon_links_into_images
         uri = URI.join(Rails.application.routes.url_helpers.root_url, "/api/v1/images/create.json")

         links = Link.where(type: ["IconLink", "PhotoLink"]).find_each do |l|
            url = Addressable::URI.parse(l.url).normalize.to_s
Severity: Minor
Found in app/lib/tasks.rb - About 1 hr to fix

    Method load has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

       def load
          unassigned = Resource.unassigned.image
          objects =
             unassigned.map do |r|
                info = Memory.find_by(short_name: r[:props]['short_name'])
    Severity: Minor
    Found in app/services/image_sync_service.rb - 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

    Method fix_links_for_calendary has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def fix_links_for_calendary string, slug
             cal = Calendary.by_slug(slug).first
    
             Link.transaction do
                Link.where("url ~* ?", string).where(info_type: "Memory").map do |x|
    Severity: Minor
    Found in app/lib/tasks.rb - 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 render has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

       render() {
          console.log("[render] * props:", this.props, "state: ", this.state)
          console.debug("[componentDidMount1]render ** ", this.getErrorText(this.props.value))
    
          return (
    Severity: Minor
    Found in app/components/DynamicField.jsx - About 1 hr to fix

      Function matchBound has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

         matchBound(date, forward, backward, strictDay, strictMonth, weekDayIn, weekDay, easter, year, baseDateRef) {
            let cond = false,
                condDate,
                baseDate = baseDateRef["date"],
                condString = `${weekDayIn && "+weekDayIn == weekDay" || "true"} && date ${baseDate && "<=" || ">="} condDate`
      Severity: Minor
      Found in app/components/PickMeUpCalendar.jsx - 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

      Method find has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

         def find *args
            if self.respond_to?( :default_key )
               new_args = args.flatten.reject { |a| a.blank? }
               rel = self.where(self.default_key => new_args)
               if rel.size < new_args.size
      Severity: Minor
      Found in app/models/concerns/default_key.rb - 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 getPathsFromState has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getPathsFromState(state) {
         console.debug("[getPathsFromState] <<<", state)
         console.debug("[getPathsFromState] **", state.calendarySlug, state.memory?.slug, state.eventee, state.gallery)
         let calendarySlug = state.query.c?.split(",").length == 1 && state.query.c ||
             state.query.c?.split(",")?.length == 0 && state.calendarySlug || null,
      Severity: Minor
      Found in app/components/support.jsx - 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

      Method info has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

         def info file
            imageinfo = `identify "#{esc(file)}" 2>&1`.strip
            fileinfo = `file -- "#{esc(file)}" 2>&1`.strip
      
            unless /(?<type>GIF|JPEG|WEBP|PNG|BMP3?) (?<width>\d+)x(?<height>\d+)/ =~ imageinfo
      Severity: Minor
      Found in app/services/image_sync_service.rb - 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 render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

         render() {
            console.debug("[render] **", { 'this.props': this.props, 'this.state': this.state })
      
            return (
               !this.state.errored && <div
      Severity: Minor
      Found in app/components/Image.jsx - About 1 hr to fix

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

           getErrorText(value_in, context_in = {}) {
              let context = merge(this.props.validation_context || {}, context_in),
                  errors = [],
                  value = value_in || ''
        
        
        Severity: Minor
        Found in app/components/Validation.jsx - About 1 hr to fix

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

             onSuccessLoad(response) {
                let new_records, new_page, new_state, records = response.data
          
                console.log("[onSuccessLoad] > response", response)
                console.log("[onSuccessLoad] > records", records)
          Severity: Minor
          Found in app/components/Records.jsx - About 1 hr to fix

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

               render() {
                  console.log("[render] > this.props", this.props)
            
                  return (
                     <div className='col s12'>
            Severity: Minor
            Found in app/components/Description.jsx - About 1 hr to fix

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

                 def validate_each(record, attribute, value)
                    options.each do |(type, sub_options)|
                       value_in =
                          case type
                          when :width, :height
              Severity: Minor
              Found in app/validators/size_validator.rb - About 1 hr to fix

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

                   def load
                      unassigned = Resource.unassigned.image
                      objects =
                         unassigned.map do |r|
                            info = Memory.find_by(short_name: r[:props]['short_name'])
                Severity: Minor
                Found in app/services/image_sync_service.rb - About 1 hr to fix

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

                     render() {
                        console.log("[render] > props:", this.props)
                  
                        return (
                           <div className='row'
                  Severity: Minor
                  Found in app/components/MemorySpans.jsx - About 1 hr to fix

                    Method fix_links_for_calendary has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def fix_links_for_calendary string, slug
                             cal = Calendary.by_slug(slug).first
                    
                             Link.transaction do
                                Link.where("url ~* ?", string).where(info_type: "Memory").map do |x|
                    Severity: Minor
                    Found in app/lib/tasks.rb - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                            if (!this.triggered || humanized_value &&
                                (!humanized_value.includes(this.triggered) &&
                                 !this.triggered.includes(humanized_value) ||
                                 this.data && (this.data.total > Object.keys(this.data.list).length &&
                                  humanized_value.includes(this.triggered) ||
                      Severity: Critical
                      Found in app/components/DynamicField.jsx - About 1 hr to fix

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

                           render() {
                              console.log("[render] > props:", this.props, "state:", this.state)
                        
                              return (
                                 <li
                        Severity: Minor
                        Found in app/components/MemorySpan.jsx - About 1 hr to fix

                          Method validate_each has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                             def validate_each(record, attribute, value)
                                o = plain_options
                                code = record.alphabeth_code.to_s.to_sym
                                res = Languageble::MATCH_TABLE[ code ]
                                if res
                          Severity: Minor
                          Found in app/validators/alphabeth_validator.rb - About 1 hr to fix

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

                               render() {
                                  console.log("[render] * this.props", this.props)
                            
                                  return (
                                     <div className='row calendary'>
                            Severity: Minor
                            Found in app/components/PickMeUpCalendar.jsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language