Boostport/migration

View on GitHub

Showing 8 of 22 total issues

Method Driver.Migrate has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (driver *Driver) Migrate(migration *m.PlannedMigration) (err error) {
    var (
        migrationStatements *parser.ParsedMigration
        insertVersion       string
    )
Severity: Minor
Found in driver/sqlite/sqlite.go - 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 Driver.Migrate has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (driver *Driver) Migrate(migration *m.PlannedMigration) (err error) {
    var (
        migrationStatements *parser.ParsedMigration
        insertVersion       string
    )
Severity: Minor
Found in driver/postgres/postgres.go - 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 Driver.Migrate has 7 return statements (exceeds 4 allowed).
Open

func (driver *Driver) Migrate(migration *m.PlannedMigration) (err error) {
    var (
        migrationStatements *parser.ParsedMigration
        insertVersion       string
    )
Severity: Major
Found in driver/postgres/postgres.go - About 45 mins to fix

    Method Driver.Migrate has 7 return statements (exceeds 4 allowed).
    Open

    func (driver *Driver) Migrate(migration *m.PlannedMigration) (err error) {
        var (
            migrationStatements *parser.ParsedMigration
            insertVersion       string
        )
    Severity: Major
    Found in driver/sqlite/sqlite.go - About 45 mins to fix

      Function New has 5 return statements (exceeds 4 allowed).
      Open

      func New(dsn string) (m.Driver, error) {
          parsedDSN, err := mysql.ParseDSN(dsn)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in driver/mysql/mysql.go - About 35 mins to fix

        Function Parse has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
        Open

        func Parse(r io.Reader) (*ParsedMigration, error) {
            p := &ParsedMigration{
                UseTransaction: true,
                Statements:     []string{},
            }
        Severity: Minor
        Found in parser/parser.go - 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

        Function getMigrations has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
        Open

        func getMigrations(migrations Source) ([]*Migration, error) {
            var m []*Migration
            tempMigrations := map[string]*Migration{}
        
            files, err := migrations.ListMigrationFiles()
        Severity: Minor
        Found in migration.go - 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

        Function getMigrations has 5 return statements (exceeds 4 allowed).
        Open

        func getMigrations(migrations Source) ([]*Migration, error) {
            var m []*Migration
            tempMigrations := map[string]*Migration{}
        
            files, err := migrations.ListMigrationFiles()
        Severity: Major
        Found in migration.go - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language