vorteil/vorteil

View on GitHub
pkg/ext4/compiler.go

Summary

Maintainability
A
2 hrs
Test Coverage

Method Compiler.Compile has 7 return statements (exceeds 4 allowed).
Open

func (c *Compiler) Compile(ctx context.Context, w io.WriteSeeker) error {

    var err error

    err = c.writeSuperblockAndBGDT(ctx, w, 0)
Severity: Major
Found in pkg/ext4/compiler.go - About 45 mins to fix

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

    func (c *Compiler) AddFile(path string, r io.ReadCloser, size int64, force bool) error {
    
        _, base := filepath.Split(path)
        err := c.tree.Map(path, vio.CustomFile(vio.CustomFileArgs{
            Name:       base,
    Severity: Major
    Found in pkg/ext4/compiler.go and 1 other location - About 1 hr to fix
    pkg/xfs/compiler.go on lines 50..64

    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 133.

    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

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

    func (c *Compiler) Mkdir(path string) error {
    
        _, base := filepath.Split(path)
        err := c.tree.Map(path, vio.CustomFile(vio.CustomFileArgs{
            Name:  base,
    Severity: Minor
    Found in pkg/ext4/compiler.go and 1 other location - About 35 mins to fix
    pkg/xfs/compiler.go on lines 35..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 105.

    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

    exported method Compiler.MinimumSize should have comment or be unexported
    Open

    func (c *Compiler) MinimumSize() int64 {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.IncreaseMinimumInodes should have comment or be unexported
    Open

    func (c *Compiler) IncreaseMinimumInodes(inodes int64) {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.SetMinimumInodesPer64MiB should have comment or be unexported
    Open

    func (c *Compiler) SetMinimumInodesPer64MiB(inodes int64) {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.Precompile should have comment or be unexported
    Open

    func (c *Compiler) Precompile(ctx context.Context, size int64) error {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.IncreaseMinimumFreeSpace should have comment or be unexported
    Open

    func (c *Compiler) IncreaseMinimumFreeSpace(space int64) {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.Compile should have comment or be unexported
    Open

    func (c *Compiler) Compile(ctx context.Context, w io.WriteSeeker) error {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported function NewCompiler should have comment or be unexported
    Open

    func NewCompiler(args *CompilerArgs) *Compiler {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.Mkdir should have comment or be unexported
    Open

    func (c *Compiler) Mkdir(path string) error {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported type CompilerArgs should have comment or be unexported
    Open

    type CompilerArgs struct {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported type Compiler should have comment or be unexported
    Open

    type Compiler struct {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.Commit should have comment or be unexported
    Open

    func (c *Compiler) Commit(ctx context.Context) error {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.SetMinimumInodes should have comment or be unexported
    Open

    func (c *Compiler) SetMinimumInodes(inodes int64) {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.AddFile should have comment or be unexported
    Open

    func (c *Compiler) AddFile(path string, r io.ReadCloser, size int64, force bool) error {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    exported method Compiler.RegionIsHole should have comment or be unexported
    Open

    func (c *Compiler) RegionIsHole(begin, size int64) bool {
    Severity: Minor
    Found in pkg/ext4/compiler.go by golint

    There are no issues that match your filters.

    Category
    Status