Commit 52abbe6f authored by Mattia Bertorello's avatar Mattia Bertorello

Fixed all the problem reported by lll (max line length set to 160)

parent c39c4980
......@@ -12,6 +12,8 @@ linters-settings:
goconst:
min-len: 2
min-occurrences: 2
lll:
line-length: 160
misspell:
locale: US
......@@ -25,7 +27,6 @@ linters:
- goconst
- gocyclo
- govet
- lll
- maligned
- megacheck
- unparam
......@@ -119,5 +119,7 @@ func TestFQBN(t *testing.T) {
require.Equal(t, f.Package, "arduino")
require.Equal(t, f.PlatformArch, "avr")
require.Equal(t, f.BoardID, "uno")
require.Equal(t, "properties.Map{\n \"cpu\": \"atmega\",\n \"extra\": \"core=arduino\",\n \"speed\": \"1000\",\n}", f.Configs.Dump())
require.Equal(t,
"properties.Map{\n \"cpu\": \"atmega\",\n \"extra\": \"core=arduino\",\n \"speed\": \"1000\",\n}",
f.Configs.Dump())
}
......@@ -54,7 +54,8 @@ type Config struct {
// ClientID is the client id you are using
ClientID string
// RedirectURI is the redirectURI where the oauth process will redirect. It's only required since the oauth system checks for it, but we intercept the redirect before hitting it
// RedirectURI is the redirectURI where the oauth process will redirect.
// It's only required since the oauth system checks for it, but we intercept the redirect before hitting it
RedirectURI string
// Scopes is a space-separated list of scopes to require
......@@ -157,7 +158,8 @@ func (c *Config) Refresh(token string) (*Token, error) {
// cookies keeps track of the cookies for each request
type cookies map[string][]*http.Cookie
// requestAuth calls hydra and follows the redirects until it reaches the authentication page. It saves the cookie it finds so it can apply them to subsequent requests
// requestAuth calls hydra and follows the redirects until it reaches the authentication page.
// It saves the cookie it finds so it can apply them to subsequent requests
func (c *Config) requestAuth(client *http.Client) (string, cookies, error) {
uri, err := url.Parse(c.CodeURL)
if err != nil {
......
......@@ -30,7 +30,10 @@ func StartCompilationsPath() string {
return fmt.Sprintf("/builder/v1/compile")
}
// Start a compilation for the given user and saves the request (but not the generated files) on the database. requires authentication. Can return PreconditionFailed if the user has reached their maximum number of compilations per day. If the compilation failed it returns UnprocessableEntity
// Start a compilation for the given user and saves the request (but not the generated files) on the database.
// requires authentication.
// Can return PreconditionFailed if the user has reached their maximum number of compilations per day.
// If the compilation failed it returns UnprocessableEntity
func (c *Client) StartCompilations(ctx context.Context, path string, payload *Compilation) (*http.Response, error) {
req, err := c.NewStartCompilationsRequest(ctx, path, payload)
if err != nil {
......
......@@ -29,8 +29,12 @@ func ListLibrariesPath() string {
return fmt.Sprintf("/builder/v1/libraries")
}
// ListLibraries provides a list of all the latest versions of the libraries supported by Arduino Create. Doesn't require any authentication.
func (c *Client) ListLibraries(ctx context.Context, path string, maintainer *string, type1 *string, withoutType *string) (*http.Response, error) {
// ListLibraries provides a list of all the latest versions of the libraries supported by Arduino Create.
// Doesn't require any authentication.
func (c *Client) ListLibraries(
ctx context.Context,
path string, maintainer *string, type1 *string, withoutType *string) (*http.Response, error) {
req, err := c.NewListLibrariesRequest(ctx, path, maintainer, type1, withoutType)
if err != nil {
return nil, err
......@@ -68,7 +72,8 @@ func ShowLibrariesPath(id string) string {
return fmt.Sprintf("/builder/v1/libraries/%s", id)
}
// ShowLibraries provides the library identified by the :id and :pid param. Doesn't require authentication. Also contains a list of other versions of the library
// ShowLibraries provides the library identified by the :id and :pid param. Doesn't require authentication.
// Also contains a list of other versions of the library
func (c *Client) ShowLibraries(ctx context.Context, path string) (*http.Response, error) {
req, err := c.NewShowLibrariesRequest(ctx, path)
if err != nil {
......
......@@ -24,7 +24,11 @@ import (
"github.com/goadesign/goa"
)
// ArduinoBuilderBoard is a physical board belonging to a certain architecture in a package. The most obvious package is arduino, which contains architectures avr, sam and samd. It can contain multiple versions of the upload commands and options. If there is a default version it means that it's the only version officially supported. Of course if there is only one version it will be called default (default view)
// ArduinoBuilderBoard is a physical board belonging to a certain architecture in a package.
// The most obvious package is arduino, which contains architectures avr, sam and samd.
// It can contain multiple versions of the upload commands and options.
// If there is a default version it means that it's the only version officially supported.
// Of course if there is only one version it will be called default (default view)
//
// Identifier: application/vnd.arduino.builder.board+json; view=default
type ArduinoBuilderBoard struct {
......@@ -160,7 +164,11 @@ func (c *Client) DecodeArduinoBuilderBoardsv2(resp *http.Response) (*ArduinoBuil
return &decoded, err
}
// ArduinoBuilderBoardv2 is a physical board belonging to a certain architecture in a package. The most obvious package is arduino, which contains architectures avr, sam and samd. It can contain multiple versions of the upload commands and options. If there is a default version it means that it's the only version officially supported. Of course if there is only one version it will be called default (default view)
// ArduinoBuilderBoardv2 is a physical board belonging to a certain architecture in a package.
// The most obvious package is arduino, which contains architectures avr, sam and samd.
// It can contain multiple versions of the upload commands and options.
// If there is a default version it means that it's the only version officially supported.
// Of course if there is only one version it will be called default (default view)
//
// Identifier: application/vnd.arduino.builder.boardv2+json; view=default
type ArduinoBuilderBoardv2 struct {
......@@ -177,7 +185,11 @@ type ArduinoBuilderBoardv2 struct {
Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
}
// ArduinoBuilderBoardv2Full is a physical board belonging to a certain architecture in a package. The most obvious package is arduino, which contains architectures avr, sam and samd. It can contain multiple versions of the upload commands and options. If there is a default version it means that it's the only version officially supported. Of course if there is only one version it will be called default (full view)
// ArduinoBuilderBoardv2Full is a physical board belonging to a certain architecture in a package.
// The most obvious package is arduino, which contains architectures avr, sam and samd.
// It can contain multiple versions of the upload commands and options.
// If there is a default version it means that it's the only version officially supported.
// Of course if there is only one version it will be called default (full view)
//
// Identifier: application/vnd.arduino.builder.boardv2+json; view=full
type ArduinoBuilderBoardv2Full struct {
......@@ -343,7 +355,9 @@ func (c *Client) DecodeArduinoBuilderBoardv2FullCollection(resp *http.Response)
return decoded, err
}
// ArduinoBuilderCompilationResult is the result of a compilation. It contains the output and the eventual errors. If successful it contains the generated files. (default view)
// ArduinoBuilderCompilationResult is the result of a compilation.
// It contains the output and the eventual errors.
// If successful it contains the generated files. (default view)
//
// Identifier: application/vnd.arduino.builder.compilation.result; view=default
type ArduinoBuilderCompilationResult struct {
......@@ -388,8 +402,8 @@ type ArduinoBuilderExample struct {
Types []string `form:"types,omitempty" json:"types,omitempty" xml:"types,omitempty"`
}
// An ArduinoBuilderExampleLink is a simple sketch with the purpose of demonstrating the capabilities of the language. (link view)
//
// An ArduinoBuilderExampleLink is a simple sketch with the purpose of demonstrating the capabilities of the language.
// (link view)
// Identifier: application/vnd.arduino.builder.example+json; view=link
type ArduinoBuilderExampleLink struct {
// The url where to find the details
......@@ -471,7 +485,9 @@ func (c *Client) DecodeArduinoBuilderFileCollection(resp *http.Response) (Arduin
return decoded, err
}
// ArduinoBuilderLibrary is a collection of header files containing arduino reusable code and functions. It typically contains its info in a library.properties files. The examples property contains a list of examples that use that library. (default view)
// ArduinoBuilderLibrary is a collection of header files containing arduino reusable code and functions.
// It typically contains its info in a library.properties files.
// The examples property contains a list of examples that use that library. (default view)
//
// Identifier: application/vnd.arduino.builder.library+json; view=default
type ArduinoBuilderLibrary struct {
......@@ -489,7 +505,8 @@ type ArduinoBuilderLibrary struct {
Files []*ArduinoBuilderFile `form:"files,omitempty" json:"files,omitempty" xml:"files,omitempty"`
// The url where to find the details
Href *string `form:"href,omitempty" json:"href,omitempty" xml:"href,omitempty"`
// The id of the library. It could be a combination of name and version, a combination of the package and architecture, or an uuid id
// The id of the library.
// It could be a combination of name and version, a combination of the package and architecture, or an uuid id
ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
// The maintainer of the library
Maintainer *string `form:"maintainer,omitempty" json:"maintainer,omitempty" xml:"maintainer,omitempty"`
......@@ -507,7 +524,9 @@ type ArduinoBuilderLibrary struct {
Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"`
}
// ArduinoBuilderLibraryLink is a collection of header files containing arduino reusable code and functions. It typically contains its info in a library.properties files. The examples property contains a list of examples that use that library. (link view)
// ArduinoBuilderLibraryLink is a collection of header files containing arduino reusable code and functions.
// It typically contains its info in a library.properties files.
// The examples property contains a list of examples that use that library. (link view)
//
// Identifier: application/vnd.arduino.builder.library+json; view=link
type ArduinoBuilderLibraryLink struct {
......@@ -542,7 +561,8 @@ type ArduinoBuilderSlimlibrary struct {
// The number of examples that it contains
ExamplesNumber *int `form:"examples_number,omitempty" json:"examples_number,omitempty" xml:"examples_number,omitempty"`
Href *string `form:"href,omitempty" json:"href,omitempty" xml:"href,omitempty"`
// The id of the library. It could be a combination of name and version, a combination of the package and architecture, or an uuid id
// The id of the library.
// It could be a combination of name and version, a combination of the package and architecture, or an uuid id
ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
// The maintainer of the library
Maintainer *string `form:"maintainer,omitempty" json:"maintainer,omitempty" xml:"maintainer,omitempty"`
......
......@@ -40,7 +40,8 @@ func (c *Client) AddPinnedLibraries(ctx context.Context, path string) (*http.Res
return c.Client.Do(ctx, req)
}
// NewAddPinnedLibrariesRequest create the request corresponding to the add action endpoint of the pinnedLibraries resource.
// NewAddPinnedLibrariesRequest create the request
// corresponding to the add action endpoint of the pinnedLibraries resource.
func (c *Client) NewAddPinnedLibrariesRequest(ctx context.Context, path string) (*http.Request, error) {
scheme := c.Scheme
if scheme == "" {
......
......@@ -21,7 +21,9 @@ import (
"github.com/goadesign/goa"
)
// A compilation is made up of a sketch (or a path to a sketch) and an fqbn. Eventual libraries are automatically determined and linked. NOTE: swagger will force you to define the files inside the sketch because of a bug. But they are not mandatory.
// A compilation is made up of a sketch (or a path to a sketch) and an fqbn.
// Eventual libraries are automatically determined and linked.
// NOTE: swagger will force you to define the files inside the sketch because of a bug. But they are not mandatory.
type compilation struct {
// The fully qualified board name
Fqbn *string `form:"fqbn,omitempty" json:"fqbn,omitempty" xml:"fqbn,omitempty"`
......@@ -72,7 +74,9 @@ func (ut *compilation) Publicize() *Compilation {
return &pub
}
// A Compilation is made up of a sketch (or a path to a sketch) and an fqbn. Eventual libraries are automatically determined and linked. NOTE: swagger will force you to define the files inside the sketch because of a bug. But they are not mandatory.
// A Compilation is made up of a sketch (or a path to a sketch) and an fqbn.
// Eventual libraries are automatically determined and linked.
// NOTE: swagger will force you to define the files inside the sketch because of a bug. But they are not mandatory.
type Compilation struct {
// The fully qualified board name
Fqbn string `form:"fqbn" json:"fqbn" xml:"fqbn"`
......@@ -275,7 +279,8 @@ func (ut *filemeta) Publicize() *Filemeta {
return &pub
}
// FileMeta represent a file in the filesystem, belonging to a sketch, a library or an example. Can contain a data property with the content of the file.
// FileMeta represent a file in the filesystem, belonging to a sketch, a library or an example.
// Can contain a data property with the content of the file.
type Filemeta struct {
// The contents of the file, in base64
Data *string `form:"data,omitempty" json:"data,omitempty" xml:"data,omitempty"`
......@@ -291,7 +296,9 @@ func (ut *Filemeta) Validate() (err error) {
return
}
// Library is a collection of header files containing arduino reusable code and functions. It typically contains its info in a library.properties files. The examples property contains a list of examples that use that library.
// Library is a collection of header files containing arduino reusable code and functions.
// It typically contains its info in a library.properties files.
// The examples property contains a list of examples that use that library.
type library struct {
// The architectures supported by the library.
Architectures []string `form:"architectures,omitempty" json:"architectures,omitempty" xml:"architectures,omitempty"`
......@@ -391,7 +398,9 @@ func (ut *library) Publicize() *Library {
return &pub
}
// Library is a collection of header files containing arduino reusable code and functions. It typically contains its info in a library.properties files. The examples property contains a list of examples that use that library.
// Library is a collection of header files containing arduino reusable code and functions.
// It typically contains its info in a library.properties files.
// The examples property contains a list of examples that use that library.
type Library struct {
// The architectures supported by the library.
Architectures []string `form:"architectures,omitempty" json:"architectures,omitempty" xml:"architectures,omitempty"`
......@@ -468,7 +477,9 @@ type PinnedLib struct {
Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"`
}
// A sketch is a program intended to run on an arduino board. It's composed by a main .ino file and optional other files. You should upload only .ino and .h files.
// A sketch is a program intended to run on an arduino board.
// It's composed by a main .ino file and optional other files.
// You should upload only .ino and .h files.
type sketch struct {
// Other files contained in the example
Files []*filefull `form:"files,omitempty" json:"files,omitempty" xml:"files,omitempty"`
......@@ -527,7 +538,8 @@ func (ut *sketch) Publicize() *Sketch {
return &pub
}
// A sketch is a program intended to run on an arduino board. It's composed by a main .ino file and optional other files. You should upload only .ino and .h files.
// A sketch is a program intended to run on an arduino board.
// It's composed by a main .ino file and optional other files. You should upload only .ino and .h files.
type Sketch struct {
// Other files contained in the example
Files []*Filefull `form:"files,omitempty" json:"files,omitempty" xml:"files,omitempty"`
......
......@@ -46,8 +46,10 @@ func initAttachCommand() *cobra.Command {
Args: cobra.RangeArgs(1, 2),
Run: runAttachCommand,
}
attachCommand.Flags().StringVar(&attachFlags.boardFlavour, "flavour", "default", "The Name of the CPU flavour, it is required for some boards (e.g. Arduino Nano).")
attachCommand.Flags().StringVar(&attachFlags.searchTimeout, "timeout", "5s", "The timeout of the search of connected devices, try to high it if your board is not found (e.g. to 10s).")
attachCommand.Flags().StringVar(&attachFlags.boardFlavour, "flavour", "default",
"The Name of the CPU flavour, it is required for some boards (e.g. Arduino Nano).")
attachCommand.Flags().StringVar(&attachFlags.searchTimeout, "timeout", "5s",
"The timeout of the search of connected devices, try to high it if your board is not found (e.g. to 10s).")
return attachCommand
}
......
......@@ -39,7 +39,8 @@ func initListCommand() *cobra.Command {
Args: cobra.NoArgs,
Run: runListCommand,
}
listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "5s", "The timeout of the search of connected devices, try to high it if your board is not found (e.g. to 10s).")
usage := "The timeout of the search of connected devices, try to high it if your board is not found (e.g. to 10s)."
listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "5s", usage)
return listCommand
}
......
......@@ -48,16 +48,26 @@ func InitCommand() *cobra.Command {
Args: cobra.MaximumNArgs(1),
Run: run,
}
command.Flags().StringVarP(&flags.fqbn, "fqbn", "b", "", "Fully Qualified Board Name, e.g.: arduino:avr:uno")
command.Flags().BoolVar(&flags.showProperties, "show-properties", false, "Show all build properties used instead of compiling.")
command.Flags().BoolVar(&flags.preprocess, "preprocess", false, "Print preprocessed code to stdout instead of compiling.")
command.Flags().StringVar(&flags.buildCachePath, "build-cache-path", "", "Builds of 'core.a' are saved into this path to be cached and reused.")
command.Flags().StringVar(&flags.buildPath, "build-path", "", "Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.")
command.Flags().StringSliceVar(&flags.buildProperties, "build-properties", []string{}, "List of custom build properties separated by commas. Or can be used multiple times for multiple properties.")
command.Flags().StringVar(&flags.warnings, "warnings", "none", `Optional, can be "none", "default", "more" and "all". Defaults to "none". Used to tell gcc which warning level to use (-W flag).`)
command.Flags().BoolVarP(&flags.verbose, "verbose", "v", false, "Optional, turns on verbose mode.")
command.Flags().BoolVar(&flags.quiet, "quiet", false, "Optional, supresses almost every output.")
command.Flags().StringVar(&flags.vidPid, "vid-pid", "", "When specified, VID/PID specific build properties are used, if boards supports them.")
command.Flags().StringVarP(&flags.fqbn, "fqbn", "b", "",
"Fully Qualified Board Name, e.g.: arduino:avr:uno")
command.Flags().BoolVar(&flags.showProperties, "show-properties", false,
"Show all build properties used instead of compiling.")
command.Flags().BoolVar(&flags.preprocess, "preprocess", false,
"Print preprocessed code to stdout instead of compiling.")
command.Flags().StringVar(&flags.buildCachePath, "build-cache-path", "",
"Builds of 'core.a' are saved into this path to be cached and reused.")
command.Flags().StringVar(&flags.buildPath, "build-path", "",
"Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.")
command.Flags().StringSliceVar(&flags.buildProperties, "build-properties", []string{},
"List of custom build properties separated by commas. Or can be used multiple times for multiple properties.")
command.Flags().StringVar(&flags.warnings, "warnings", "none",
`Optional, can be "none", "default", "more" and "all". Defaults to "none". Used to tell gcc which warning level to use (-W flag).`)
command.Flags().BoolVarP(&flags.verbose, "verbose", "v", false,
"Optional, turns on verbose mode.")
command.Flags().BoolVar(&flags.quiet, "quiet", false,
"Optional, supresses almost every output.")
command.Flags().StringVar(&flags.vidPid, "vid-pid", "",
"When specified, VID/PID specific build properties are used, if boards supports them.")
return command
}
......@@ -128,7 +138,10 @@ func run(cmd *cobra.Command, args []string) {
PlatformArchitecture: coreName,
})
if targetPlatform == nil || targetPlatform.GetInstalled() == nil {
formatter.PrintErrorMessage(fmt.Sprintf("\"%[1]s:%[2]s\" platform is not installed, please install it by running \""+commands.AppName+" core install %[1]s:%[2]s\".", packageName, coreName))
errorMessage := fmt.Sprintf(
"\"%[1]s:%[2]s\" platform is not installed, please install it by running \""+
commands.AppName+" core install %[1]s:%[2]s\".", packageName, coreName)
formatter.PrintErrorMessage(errorMessage)
os.Exit(commands.ErrCoreConfig)
}
......
......@@ -39,8 +39,14 @@ func initInitCommand() *cobra.Command {
Args: cobra.NoArgs,
Run: runInitCommand,
}
initCommand.Flags().BoolVar(&initFlags._default, "default", false, "If omitted, ask questions to the user about setting configuration properties, otherwise use default configuration.")
initCommand.Flags().StringVar(&initFlags.location, "save-as", "", "Sets where to save the configuration file [default is ./.cli-config.yml].")
initCommand.Flags().BoolVar(&initFlags._default,
"default",
false,
"If omitted, ask questions to the user about setting configuration properties, otherwise use default configuration.")
initCommand.Flags().StringVar(&initFlags.location,
"save-as",
"",
"Sets where to save the configuration file [default is ./.cli-config.yml].")
return initCommand
}
......
......@@ -57,7 +57,8 @@ func initSyncCommand() *cobra.Command {
Args: cobra.NoArgs,
Run: runSyncCommand,
}
syncCommand.Flags().StringVar(&syncFlags.priority, "conflict-policy", prioritySkip, "The decision made by default on conflicting sketches. Can be push-local, pull-remote, skip, ask-once, ask-always.")
usage := "The decision made by default on conflicting sketches. Can be push-local, pull-remote, skip, ask-once, ask-always."
syncCommand.Flags().StringVar(&syncFlags.priority, "conflict-policy", prioritySkip, usage)
return syncCommand
}
......@@ -296,7 +297,11 @@ func pushSketch(sketch sketches.Sketch, sketchbook *paths.Path, bearerToken stri
func editSketch(sketch sketches.Sketch, sketchbook *paths.Path, bearerToken string) error {
client := createclient.New(nil)
resp, err := client.EditSketches(context.Background(), createclient.EditSketchesPath(sketch.ID), createclient.ConvertFrom(sketch), "Bearer "+bearerToken)
resp, err := client.EditSketches(
context.Background(),
createclient.EditSketchesPath(sketch.ID),
createclient.ConvertFrom(sketch),
"Bearer "+bearerToken)
if err != nil {
return err
}
......
......@@ -77,7 +77,9 @@ func (c *Client) DecodeArduinoCreateLibraries(resp *http.Response) (*ArduinoCrea
return &decoded, err
}
// Library is a collection of header files containing arduino reusable code and functions. It typically contains its info in a library.properties files. The examples property contains a list of examples that use that library. (default view)
// Library is a collection of header files containing arduino reusable code and functions.
// It typically contains its info in a library.properties files.
// The examples property contains a list of examples that use that library. (default view)
//
// Identifier: application/vnd.arduino.create.library+json; view=default
type ArduinoCreateLibrary struct {
......@@ -115,7 +117,9 @@ type ArduinoCreateLibrary struct {
Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"`
}
// Library is a collection of header files containing arduino reusable code and functions. It typically contains its info in a library.properties files. The examples property contains a list of examples that use that library. (link view)
// Library is a collection of header files containing arduino reusable code and functions.
// It typically contains its info in a library.properties files.
// The examples property contains a list of examples that use that library. (link view)
//
// Identifier: application/vnd.arduino.create.library+json; view=link
type ArduinoCreateLibraryLink struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment