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)
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,
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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,
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
exported method Compiler.MinimumSize should have comment or be unexported Open
func (c *Compiler) MinimumSize() int64 {
- Exclude checks
exported method Compiler.IncreaseMinimumInodes should have comment or be unexported Open
func (c *Compiler) IncreaseMinimumInodes(inodes int64) {
- Exclude checks
exported method Compiler.SetMinimumInodesPer64MiB should have comment or be unexported Open
func (c *Compiler) SetMinimumInodesPer64MiB(inodes int64) {
- Exclude checks
exported method Compiler.Precompile should have comment or be unexported Open
func (c *Compiler) Precompile(ctx context.Context, size int64) error {
- Exclude checks
exported method Compiler.IncreaseMinimumFreeSpace should have comment or be unexported Open
func (c *Compiler) IncreaseMinimumFreeSpace(space int64) {
- Exclude checks
exported method Compiler.Compile should have comment or be unexported Open
func (c *Compiler) Compile(ctx context.Context, w io.WriteSeeker) error {
- Exclude checks
exported function NewCompiler should have comment or be unexported Open
func NewCompiler(args *CompilerArgs) *Compiler {
- Exclude checks
exported method Compiler.Mkdir should have comment or be unexported Open
func (c *Compiler) Mkdir(path string) error {
- Exclude checks
exported type CompilerArgs should have comment or be unexported Open
type CompilerArgs struct {
- Exclude checks
exported type Compiler should have comment or be unexported Open
type Compiler struct {
- Exclude checks
exported method Compiler.Commit should have comment or be unexported Open
func (c *Compiler) Commit(ctx context.Context) error {
- Exclude checks
exported method Compiler.SetMinimumInodes should have comment or be unexported Open
func (c *Compiler) SetMinimumInodes(inodes int64) {
- Exclude checks
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 {
- Exclude checks
exported method Compiler.RegionIsHole should have comment or be unexported Open
func (c *Compiler) RegionIsHole(begin, size int64) bool {
- Exclude checks