Skip to content

Commit

Permalink
Rename module_pinned_source to terraform_module_pinned_source
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarDarwish committed Apr 17, 2017
1 parent 80bbe81 commit e3cc826
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ func (d *Detector) Detect() []*issue.Issue {
d.Logger.Info(fmt.Sprintf("ignore module `%s`", name))
continue
}
// Special case for module_pinned_source rule
modulePinnedSourceRule := "module_pinned_source"
if d.Config.IgnoreModule[modulePinnedSourceRule] {
// Special case for terraform_module_pinned_source rule
modulePinnedSourceRule := "terraform_module_pinned_source"
if d.Config.IgnoreRule[modulePinnedSourceRule] {
d.Logger.Info(fmt.Sprintf("ignore module `%s`", modulePinnedSourceRule))
continue
}
d.Logger.Info(fmt.Sprintf("run module linter `%s`", name))
modulePinnedSourceDetector := NewModulePinnedSourceDetector(d, m.File, m.ObjectItem)
modulePinnedSourceDetector := NewTerraformModulePinnedSourceDetector(d, m.File, m.ObjectItem)
modulePinnedSourceDetector.DetectPinnedModuleSource(&issues)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"github.com/wata727/tflint/issue"
)

type ModulePinnedSourceDetector struct {
type TerraformModulePinnedSourceDetector struct {
source string
line int
file string
}

func NewModulePinnedSourceDetector(detector *Detector, file string, item *ast.ObjectItem) *ModulePinnedSourceDetector {
func NewTerraformModulePinnedSourceDetector(detector *Detector, file string, item *ast.ObjectItem) *TerraformModulePinnedSourceDetector {
sourceToken, err := hclLiteralToken(item, "source")
if err != nil {
detector.Logger.Error(err)
Expand All @@ -26,14 +26,14 @@ func NewModulePinnedSourceDetector(detector *Detector, file string, item *ast.Ob
return nil
}

return &ModulePinnedSourceDetector{
return &TerraformModulePinnedSourceDetector{
source: sourceText,
file: file,
line: sourceToken.Pos.Line,
}
}

func (d *ModulePinnedSourceDetector) DetectPinnedModuleSource(issues *[]*issue.Issue) {
func (d *TerraformModulePinnedSourceDetector) DetectPinnedModuleSource(issues *[]*issue.Issue) {
lower := strings.ToLower(d.source)

if strings.Contains(lower, "git") || strings.Contains(lower, "bitbucket") {
Expand All @@ -49,7 +49,7 @@ func (d *ModulePinnedSourceDetector) DetectPinnedModuleSource(issues *[]*issue.I
}
}

func (d *ModulePinnedSourceDetector) detectGitSource(source string) *issue.Issue {
func (d *TerraformModulePinnedSourceDetector) detectGitSource(source string) *issue.Issue {
if strings.Contains(source, "ref=") {
if strings.Contains(source, "ref=master") {
return &issue.Issue{
Expand All @@ -71,7 +71,7 @@ func (d *ModulePinnedSourceDetector) detectGitSource(source string) *issue.Issue
return nil
}

func (d *ModulePinnedSourceDetector) detectMercurialSource(source string) *issue.Issue {
func (d *TerraformModulePinnedSourceDetector) detectMercurialSource(source string) *issue.Issue {
if strings.Contains(source, "rev=") {
if strings.Contains(source, "rev=default") {
return &issue.Issue{
Expand Down
File renamed without changes.

0 comments on commit e3cc826

Please sign in to comment.