znamenica/dneslov

View on GitHub

Showing 99 of 2,171 total issues

Function dateFor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

   static dateFor(yearDate, msDate, style) {
      console.debug("[dateFor] <<<", yearDate, msDate, style)

      let dateIn = new Date(msDate || Date.now()),
          yearIn = dateIn.getFullYear(),
Severity: Minor
Found in app/components/EventSpans.jsx - About 1 hr to fix

    Function render has 32 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/SearchConditions.jsx - About 1 hr to fix

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

            def fix_memo_scripta_for_scripta
               Scriptum.transaction do
                  Scriptum.find_each do |s|
                     begin
                        if s.memo_scripta.blank? && s.service_scripta.present?
      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

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

         def self.included base
            base.class_eval do
               has_many :titles, -> { title }, as: :describable, class_name: :Title
               has_many :default_titles, -> { distinct }, through: :kind, source: :names, class_name: :Appellation
               has_many :all_titles, ->(this) do
      Severity: Minor
      Found in app/models/concerns/with_titles.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 attrs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

         def attrs
            @attrs ||=
               folders.map do |folder|
                  fbase = File.basename(folder)
                  target_path = File.join(now.strftime("%Y"), now.strftime("%m"), now.strftime("%Y%m%d%H%M%S"))
      Severity: Minor
      Found in app/services/image_sync_service.rb - About 1 hr to fix

        Function getPathsFromState has 30 lines of code (exceeds 25 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

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

                   value: (value) => {
                      const scriptumTable = {
                         'Prolog': 'Пролог',
                         'Irmos': 'Ирмос',
                         'Ikos': 'Икос',
          Severity: Minor
          Found in app/components/scriptumMeta.jsx - About 1 hr to fix

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

               render() {
                  return [
                     <div className="fixed-action-btn">
                        <Steps
                           enabled={this.state.enabled}
            Severity: Minor
            Found in app/components/Intro.jsx - About 1 hr to fix

              Function onApplyRange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                 onApplyRange() {
                    let r = this.state.pendingRange,
                        beginName = this.repathTo(this.props.name, "begin"),
                        endName = this.repathTo(this.props.name, "end"),
                        valueDetail, ce,
              Severity: Minor
              Found in app/components/DynamicField.jsx - About 1 hr to fix

                Method year_date_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                   def self.year_date_for year_date, date_in, julian
                      return nil if date_in.blank?
                
                      date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
                      if /(?<day>\d+)\.(?<month>\d+)%(?<weekday>\d+)$/ =~ year_date
                Severity: Minor
                Found in app/models/event.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 set_base_year has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                   def set_base_year
                      types = %w(Resurrection Repose Writing Appearance Translation Sanctification)
                
                      event = self.events.to_a.sort_by { |x| (types.index(x.kind) || 100) }.first
                
                
                Severity: Minor
                Found in app/models/memory.rb - About 1 hr to fix

                  Function renderModal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                     renderModal() {
                        return (
                           <div className='enrighten'>
                              <div
                                 key='calendary-form-modal'
                  Severity: Minor
                  Found in app/components/Modal.jsx - About 1 hr to fix

                    Function matchBound has 26 lines of code (exceeds 25 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

                      Function getUrlsFrom has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function getUrlsFrom(calendarySlug, memorySlug, eventeeId) {
                         console.debug("[getUrlsFrom] <<<", calendarySlug, memorySlug, eventeeId)
                         console.debug("[getUrlsFrom] **", Object.fromEntries(new URLSearchParams(window.location.search)))
                         let path = "/" + [calendarySlug, memorySlug, eventeeId].compact().join("/"),
                             json_path = (path === '/' && 'index' || path) + '.json',
                      Severity: Minor
                      Found in app/components/support.jsx - About 1 hr to fix

                        Function getUrlsFrom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function getUrlsFrom(calendarySlug, memorySlug, eventeeId) {
                           console.debug("[getUrlsFrom] <<<", calendarySlug, memorySlug, eventeeId)
                           console.debug("[getUrlsFrom] **", Object.fromEntries(new URLSearchParams(window.location.search)))
                           let path = "/" + [calendarySlug, memorySlug, eventeeId].compact().join("/"),
                               json_path = (path === '/' && 'index' || path) + '.json',
                        Severity: Minor
                        Found in app/components/support.jsx - About 55 mins 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 dates_to_days has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def dates_to_days dates_in, julian
                                 [dates_in].flatten.map do |date_in|
                                    date = date_in.is_a?(Date) && date_in || Date.parse(date_in)
                                    new_date = date.strftime('%2d.%m')
                                    gap = julian && 13.days || 0
                        Severity: Minor
                        Found in app/models/memo.rb - About 45 mins 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 matchValidJson has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function matchValidJson(text) {
                           if (text) {
                              switch (text.constructor.name) {
                                 case "String":
                                    try {
                        Severity: Minor
                        Found in app/components/matchers.jsx - About 45 mins 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 fill_in_title_description has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                           def fill_in_title_description
                              if @title
                                 if title = titles.where(language_code: @language, alphabeth_code: @alphabeth).first
                                    title.update_attribute(:text, @title)
                                 else
                        Severity: Minor
                        Found in app/models/picture.rb - About 45 mins 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 makeTweet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function makeTweet(value, locales, source = 'tweets', filter = null) {
                           let tweets = locales.map((locale) => {
                              return value[source].reduce((res, text) => {
                                 return res ||
                                    locale === text.language_code &&
                        Severity: Minor
                        Found in app/components/makers.jsx - About 45 mins 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 makeDescription has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function makeDescription(value, locales, source = 'descriptions', filter = null) {
                           let descriptions = locales.map((locale) => {
                              return value[source].reduce((res, text) => {
                                 return res ||
                                    locale === text.language_code &&
                        Severity: Minor
                        Found in app/components/makers.jsx - About 45 mins 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

                        Severity
                        Category
                        Status
                        Source
                        Language