short-d/short

View on GitHub

Showing 13 of 307 total issues

Function NewShort has 99 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func NewShort(
    instrumentationFactory request.InstrumentationFactory,
    webFrontendURL string,
    timer timer.Timer,
    shortLinkRetriever shortlink.Retriever,
Severity: Major
Found in backend/app/adapter/routing/route.go - About 2 hrs to fix

    Function main has 98 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func main() {
        env := dep.InjectEnv()
        env.AutoLoadDotEnvFile()
    
        envConfig := envconfig.NewEnvConfig(env)
    Severity: Major
    Found in backend/main.go - About 2 hrs to fix

      Function InjectRoutingService has 23 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func InjectRoutingService(runtime2 env.Runtime, prefix provider.LogPrefix, logLevel logger.LogLevel, sqlDB *sql.DB, githubClientID provider.GithubClientID, githubClientSecret provider.GithubClientSecret, facebookClientID provider.FacebookClientID, facebookClientSecret provider.FacebookClientSecret, facebookRedirectURI provider.FacebookRedirectURI, googleClientID provider.GoogleClientID, googleClientSecret provider.GoogleClientSecret, googleRedirectURI provider.GoogleRedirectURI, jwtSecret provider.JwtSecret, bufferSize provider.KeyGenBufferSize, kgsRPCConfig provider.KgsRPCConfig, webFrontendURL provider.WebFrontendURL, tokenValidDuration provider.TokenValidDuration, searchTimeout provider.SearchTimeout, swaggerUIDir provider.SwaggerUIDir, openAPISpecPath provider.OpenAPISpecPath, dataDogAPIKey provider.DataDogAPIKey, segmentAPIKey provider.SegmentAPIKey, ipStackAPIKey provider.IPStackAPIKey) (service.Routing, error) {
      Severity: Major
      Found in backend/dep/wire_gen.go - About 2 hrs to fix

        Function InjectRoutingService has 23 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            runtime env.Runtime,
            prefix provider.LogPrefix,
            logLevel logger.LogLevel,
            sqlDB *sql.DB,
            githubClientID provider.GithubClientID,
        Severity: Major
        Found in backend/dep/wire.go - About 2 hrs to fix

          Function initUIFactory has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function initUIFactory(
            envService: EnvService,
            captchaService: CaptchaService
          ): UIFactory {
            const cookieService = new CookieService();
          Severity: Major
          Found in frontend/src/dep.ts - About 2 hrs to fix

            Function InjectGraphQLService has 16 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                runtime env.Runtime,
                prefix provider.LogPrefix,
                logLevel logger.LogLevel,
                sqlDB *sql.DB,
                graphqlSchemaPath provider.GraphQLSchemaPath,
            Severity: Major
            Found in backend/dep/wire.go - About 2 hrs to fix

              Function InjectGraphQLService has 16 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func InjectGraphQLService(runtime2 env.Runtime, prefix provider.LogPrefix, logLevel logger.LogLevel, sqlDB *sql.DB, graphqlSchemaPath provider.GraphQLSchemaPath, graphqlPath provider.GraphQLPath, graphiQLDefaultQuery provider.GraphiQLDefaultQuery, secret provider.ReCaptchaSecret, jwtSecret provider.JwtSecret, bufferSize provider.KeyGenBufferSize, kgsRPCConfig provider.KgsRPCConfig, tokenValidDuration provider.TokenValidDuration, dataDogAPIKey provider.DataDogAPIKey, segmentAPIKey provider.SegmentAPIKey, ipStackAPIKey provider.IPStackAPIKey, googleAPIKey provider.GoogleAPIKey) (service.GraphQL, error) {
              Severity: Major
              Found in backend/dep/wire_gen.go - About 2 hrs to fix

                Function NewShortRoutes has 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    instrumentationFactory request.InstrumentationFactory,
                    webFrontendURL WebFrontendURL,
                    timer timer.Timer,
                    shortLinkRetriever shortlink.Retriever,
                    featureDecisionMakerFactory feature.DecisionMakerFactory,
                Severity: Major
                Found in backend/dep/provider/routes.go - About 1 hr to fix

                  Function NewShort has 12 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      instrumentationFactory request.InstrumentationFactory,
                      webFrontendURL string,
                      timer timer.Timer,
                      shortLinkRetriever shortlink.Retriever,
                      featureDecisionMakerFactory feature.DecisionMakerFactory,
                  Severity: Major
                  Found in backend/app/adapter/routing/route.go - About 1 hr to fix

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

                    function registerValidSW(swUrl, config) {
                        navigator.serviceWorker
                            .register(swUrl)
                            .then(registration => {
                                registration.onupdatefound = () => {
                    Severity: Minor
                    Found in frontend/src/serviceWorker.js - About 1 hr to fix

                      Method SingleSignOn.SignIn has 7 return statements (exceeds 4 allowed).
                      Open

                      func (o SingleSignOn) SignIn(authorizationCode string) (string, error) {
                          if len(authorizationCode) < 1 {
                              return "", errors.New("authorizationCode can't be empty")
                          }
                      
                      
                      Severity: Major
                      Found in backend/app/usecase/sso/sso.go - About 45 mins to fix

                        Function NewRootCmd has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            dbConfig db.Config,
                            config app.ServiceConfig,
                            cmdFactory cli.CommandFactory,
                            dbConnector db.Connector,
                            dbMigrationTool db.MigrationTool,
                        Severity: Minor
                        Found in backend/cmd/cmd.go - About 35 mins to fix

                          Function default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export default function(
                            WrappedComponent: React.ComponentType<any>,
                            makeAuthDecision: () => Promise<boolean>
                          ) {
                            enum AuthDecision {
                          Severity: Minor
                          Found in frontend/src/component/hoc/withPageAuth.tsx - 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