/
null.go
46 lines (38 loc) · 1.08 KB
/
null.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2015 Auburn University. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file defines the Null refactoring, which makes no changes to a program.
// It is for testing only (and can be used as a template for building new
// refactorings).
package refactoring
// A Null refactoring makes no changes to a program.
type Null struct {
RefactoringBase
}
func (r *Null) Description() *Description {
return &Description{
Name: "Null Refactoring",
Synopsis: "Refactoring that makes no changes to a program",
Usage: "<allow_errors?>",
HTMLDoc: "",
Multifile: false,
Params: []Parameter{{
Label: "Allow Errors",
Prompt: "Allow Errors",
DefaultValue: true,
}},
OptionalParams: nil,
Hidden: true,
}
}
func (r *Null) Run(config *Config) *Result {
r.Init(config, r.Description())
if config.Args[0].(bool) {
r.Log.ChangeInitialErrorsToWarnings()
}
if r.Log.ContainsErrors() {
return &r.Result
}
r.UpdateLog(config, false)
return &r.Result
}