Skip to content

Conversation

@godrei
Copy link
Contributor

@godrei godrei commented Jan 4, 2018

No description provided.

cmd/xamarin.go Outdated
continue

if enableVerboseLog {
xamSlnJSON, err := json.MarshalIndent(xamSln, "", "\t")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd/xamarin.go Outdated
if enableVerboseLog {
xamSlnJSON, err := json.MarshalIndent(xamSln, "", "\t")
if err == nil {
log.Debugf("xamSln:\n%s", xamSlnJSON)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't abbreviate in debug log (xamSln)

cmd/xamarin.go Outdated
continue
}

archivableProjectConfigNames := []string{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd/xamarin.go Outdated
)
archivableSolutionConfigNameMap := map[string]bool{}
for _, project := range xamSln.ProjectMap {
if project.SDK != constants.SDKIOS {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if project.SDK != constants.SDKIOS || project.OutputType != "exe" {
        continue
}

cmd/xamarin.go Outdated
}

archivableProjectConfigNames := []string{}
for configName, config := range project.Configs {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd/xamarin.go Outdated
return printXamarinScanFinishedWithError(
"No acceptable Project found in the provided Solution, or none can be used for iOS Archive.",
)
archivableSolutionConfigNameMap := map[string]bool{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name should imply that it is a set

cmd/xamarin.go Outdated
return printXamarinScanFinishedWithError(
"No acceptable Project found in the provided Solution, or none can be used for iOS Archive.",
)
archivableSolutionConfigNameMap := map[string]bool{}
Copy link

@kdobmayer kdobmayer Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from line 82 to 113 could be a separate function:

func archivableSolutionConfigNames(map[string]project.Model) []string

and call with

archivableSolutionConfigNames(xamSln.ProjectMap)

projectName := strings.Replace(xamarinCmd.ProjectName, ".", "_", -1)

archivesBeforeBuild, err := listArchives()
builder, err := builder.New(xamarinCmd.SolutionFilePath, []constants.SDK{constants.SDKIOS}, buildtools.Msbuild)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builder variable shadowing builder package

cmd, err := command.NewFromSlice(cmdArgs)
if err != nil {
return "", "", fmt.Errorf("Failed to create Xamarin command, error: %s", err)
callback := func(solutionName string, projectName string, sdk constants.SDK, testFramwork constants.TestFramework, commandStr string, alreadyPerformed bool) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be defined outside of this function, and use an underscore _ for not used variables.

for _, archiveBeforeBuild := range archivesBeforeBuild {
if archiveAfterBuild == archiveBeforeBuild {
isNew = false
archivesDuringBuild := []string{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd/xamarin.go Outdated
}
}
if len(archivableSolutionConfigNames) < 1 {
return printXamarinScanFinishedWithError(`No acceptable Configuration found in the provided Solution and Project, or none can be used for iOS "Archive for Publishing".`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement builtin error interface instead of calling a function which is printing and returning an error.

type ArchiveError struct {
  toolName string
  msg string
}

func (e ArchiveError) Error() string

@godrei godrei merged commit 9a4daa1 into master Jan 8, 2018
@godrei godrei deleted the xamarin-fix branch January 8, 2018 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants