Skip to content

Commit

Permalink
refactor: remove extra spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Apr 23, 2024
1 parent 61af875 commit 89003d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions pkg/fanal/analyzer/language/c/conan/conan.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,19 @@ func licensesFromCache() (map[string]string, error) {
line := strings.TrimSpace(scanner.Text())

if strings.HasPrefix(line, "name") { // cf. https://docs.conan.io/1/reference/conanfile/attributes.html#name
// trim extra characters - e.g. `name = "openssl"` -> `openssl`
name = strings.TrimSuffix(strings.TrimPrefix(line, `name = "`), `"`)
// remove spaces before and after `=` (if used). e.g. `name = "openssl"` -> `name="openssl"`
name = strings.ReplaceAll(line, " ", "")
// trim extra characters - e.g. `name="openssl"` -> `openssl`
name = strings.TrimSuffix(strings.TrimPrefix(name, `name="`), `"`)
// Check that the license is already found
if license != "" {
break
}
} else if strings.HasPrefix(line, "license") { // cf. https://docs.conan.io/1/reference/conanfile/attributes.html#license
// remove spaces before and after `=` (if used). e.g. `license = "Apache-2.0"` -> `license="Apache-2.0"`
license = strings.ReplaceAll(line, " ", "")
// trim extra characters - e.g. `license = "Apache-2.0"` -> `Apache-2.0`
license = strings.TrimSuffix(strings.TrimPrefix(line, `license = "`), `"`)
license = strings.TrimSuffix(strings.TrimPrefix(license, `license="`), `"`)
// Check that the name is already found
if name != "" {
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@


class OpenSSLConan(ConanFile):
name = "openssl"
name="openssl"
settings = "os", "arch", "compiler", "build_type"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/openssl/openssl"
license = "Apache-2.0"
license="Apache-2.0"
topics = ("ssl", "tls", "encryption", "security")
description = "A toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols"
options = {
Expand Down

0 comments on commit 89003d6

Please sign in to comment.