notyim/notyim

View on GitHub

Showing 10 of 20 total issues

Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 2 hrs to fix

    Function withClientTrace has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func withClientTrace(ctx context.Context, r *Result) context.Context {
        trace := &httptrace.ClientTrace{
            DNSStart: func(i httptrace.DNSStartInfo) {
                r.dnsStart = time.Now()
            },
    Severity: Minor
    Found in extras/gaia/scanner/httpscanner/scanner.go - About 1 hr to fix

      Method GenericEvent.UnmarshalJSON has 63 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (e *GenericEvent) UnmarshalJSON(data []byte) error {
          var temp EventWrapper
      
          if err := json.Unmarshal(data, &temp); err != nil {
              return fmt.Errorf("Unmarshal event error: %w", err)
      Severity: Minor
      Found in extras/gaia/eventbus.go - About 1 hr to fix

        Function Check has 57 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func Check(req *http.Request) *CheckResponse {
            req.Header.Set("User-Agent", "noty/2.0 (https://noty.im)")
            var result Result
        
            ctx := WithHTTPStat(req.Context(), &result)
        Severity: Minor
        Found in extras/gaia/scanner/httpscanner/scanner.go - About 1 hr to fix

          Method GenericEvent.UnmarshalJSON has 10 return statements (exceeds 4 allowed).
          Open

          func (e *GenericEvent) UnmarshalJSON(data []byte) error {
              var temp EventWrapper
          
              if err := json.Unmarshal(data, &temp); err != nil {
                  return fmt.Errorf("Unmarshal event error: %w", err)
          Severity: Major
          Found in extras/gaia/eventbus.go - About 1 hr to fix

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

              def verify
                if VerificationService.check_to_verify(@verification, params[:code])
                  case @verification.verifiable
                  when Receiver
                    redirect_to receivers_url, flash: { notice: 'You have succesflly confirm the contact' }
            Severity: Minor
            Found in app/controllers/verification_controller.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

            Method Server.SetupRoute has 6 return statements (exceeds 4 allowed).
            Open

            func (s *Server) SetupRoute() {
                secureMiddleware := secure.New(secure.Options{
                    AllowedHosts:         []string{"noty.ax", "gaia.noty.im", "laputa.noty.im", ".*.noty.im"},
                    AllowedHostsAreRegex: true,
                    HostsProxyHeaders:    []string{"X-Forwarded-Host"},
            Severity: Major
            Found in extras/gaia/server.go - About 40 mins to fix

              Method auto_prefix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def auto_prefix
                  case @check.type
                  when Check::TYPE_HTTP
                    @check.uri = "http://#{@check.uri}" unless @check.uri.start_with?('http')
                  when Check::TYPE_TCP
              Severity: Minor
              Found in app/controllers/checks_controller.rb - About 35 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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.save(receiver)
                  raise 'UserCannotManageTeam' unless can_view?(receiver)
              
                  VerificationService.generate(receiver) if receiver.save! && receiver.require_verify?
              
              
              Severity: Minor
              Found in app/services/receiver_service.rb - About 25 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 Agent.SyncState has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
              Open

              func (a *Agent) SyncState() {
                  defer a.conn.Close()
                  done := make(chan struct{})
              
                  go func() {
              Severity: Minor
              Found in extras/gaia/client/client.go - About 25 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