sue445/plant_erd

View on GitHub

Showing 7 of 13 total issues

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

func main() {
    app := cli.NewApp()

    app.Version = fmt.Sprintf("%s (build. %s)", Version, Revision)
    app.Name = "plant_erd"
Severity: Major
Found in cmd/plant_erd/main.go - About 5 hrs to fix

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

    func main() {
        app := cli.NewApp()
    
        app.Version = fmt.Sprintf("%s (build. %s)", Version, Revision)
        app.Name = "plant_erd-oracle"
    Severity: Minor
    Found in cmd/plant_erd-oracle/main.go - About 1 hr to fix

      Function main has 9 return statements (exceeds 4 allowed).
      Open

      func main() {
          app := cli.NewApp()
      
          app.Version = fmt.Sprintf("%s (build. %s)", Version, Revision)
          app.Name = "plant_erd"
      Severity: Major
      Found in cmd/plant_erd/main.go - About 55 mins to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        func (a *Adapter) GetAllTableNames() ([]string, error) {
            var rows []allTables
            // c.f. https://github.com/rsim/oracle-enhanced/blob/v6.0.0/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb#L15
            err := a.db.Select(&rows, `
                SELECT DECODE(table_name, UPPER(table_name), LOWER(table_name), table_name) AS table_name
        Severity: Major
        Found in adapter/oracle/adapter.go and 2 other locations - About 55 mins to fix
        adapter/mysql/adapter.go on lines 41..55
        adapter/sqlite3/adapter.go on lines 34..48

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 123.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method Adapter.GetTable has 6 return statements (exceeds 4 allowed).
        Open

        func (a *Adapter) GetTable(tableName string) (*db.Table, error) {
            table := db.Table{
                Name: tableName,
            }
        
        
        Severity: Major
        Found in adapter/oracle/adapter.go - About 40 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      Action: func(c *cli.Context) error {
                          adapter, close, err := sqlite3.NewAdapter(sqlite3Database)
          
                          if err != nil {
                              return err
          Severity: Minor
          Found in cmd/plant_erd/main.go and 1 other location - About 30 mins to fix
          cmd/plant_erd/main.go on lines 187..202

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 101.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      Action: func(c *cli.Context) error {
                          adapter, close, err := postgresql.NewAdapter(postgresqlConfig)
          
                          if err != nil {
                              return err
          Severity: Minor
          Found in cmd/plant_erd/main.go and 1 other location - About 30 mins to fix
          cmd/plant_erd/main.go on lines 55..70

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 101.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language