[
https://issues.apache.org/jira/browse/YUNIKORN-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850516#comment-17850516
]
Yun Sun commented on YUNIKORN-182:
----------------------------------
I try to solve the unchecked error which relates to 5 files, goconst error and
unused error of {{yunikorn-k8shim}} repo in
[https://github.com/apache/yunikorn-k8shim/pull/850.]
But there are still a lot of other errors exist. list as below:
* Error of gosec
(1)
func TestInterPodAffinity(t *testing.T) {
pkg/plugin/predicates/predicate_manager_test.go:228:14: G109: Potential Integer
overflow made by strconv.Atoi result conversion to int16/32 (gosec)
HostPort: int32(hostPort),
^
(2)
test/e2e/framework/helpers/common/utils.go:105:18: G404: Use of weak random
number generator (math/rand instead of crypto/rand) (gosec)
b[i] = letters[rand.Intn(len(letters))]
^
(3)
pkg/cmd/admissioncontroller/main.go:143:15: G112: Potential Slowloris Attack
because ReadHeaderTimeout is not configured in the http.Server (gosec)
wh.server = &http.Server{
Addr: fmt.Sprintf(":%v", wh.port),
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS12, // No SSL,
TLS 1.0 or TLS 1.1 support
NextProtos: []string\{"h2", "http/1.1"}, // prefer
HTTP/2 over HTTP/1.1
CipherSuites: wh.getCipherSuites(), // limit
cipher suite to secure ones
Certificates: []tls.Certificate\{*certs},
},
Handler: mux,
} * Error of govet
(1)
func TestGetNodesInfoPodsWithAffinity(t *testing.T) {
test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go:67:8: shadow:
declaration of "err" shadows declaration at line 46 (govet)
ns1, err := kClient.CreateNamespace(sparkNS, nil)
^
(2)
test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go:97:3: shadow:
declaration of "err" shadows declaration at line 46 (govet)
err := exec.Command(
^
(3)
test/e2e/gang_scheduling/gang_scheduling_test.go:711:4: shadow: declaration of
"err" shadows declaration at line 696 (govet)
err := kClient.DeleteConfigMap(testConfigmap.Name, ns)
^
(4)
test/e2e/gang_scheduling/gang_scheduling_test.go:715:18: shadow: declaration of
"err" shadows declaration at line 696 (govet)
testConfigmap, err := kClient.CreateConfigMap(testConfigmap, ns)
^ * Error of ineffassign
(1)
test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go:56:3: ineffectual
assignment to sparkHome (ineffassign)
sparkHome = "/usr/local/"
^
(2)
pkg/cache/context.go:795:8: ineffectual assignment to allBound (ineffassign)
var allBound = true
^ * Error of gofmt
(1)
pkg/cache/task_state_test.go:2: File is not `gofmt`-ed with `-s` (gofmt)
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
[http://www.apache.org/licenses/LICENSE-2.0] Unless required by applicable law
or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. * Error of goimports
(1)
pkg/cmd/shim/main.go:25: File is not `goimports`-ed with -local
[github.com/apache/yunikorn|http://github.com/apache/yunikorn] (goimports)
(2)
pkg/cache/task_state_test.go:10: File is not `goimports`-ed with -local
[github.com/apache/yunikorn|http://github.com/apache/yunikorn] (goimports)
[http://www.apache.org/licenses/LICENSE-2.0] * Error of godox
(1)
pkg/client/kubeclient.go:141: pkg/client/kubeclient.go:141: Line contains
TODO/BUG/FIXME: "TODO make this configurable for pods" (godox)
// TODO make this configurable for pods * Error of fulen
(1)
pkg/cache/external/scheduler_cache_test.go:310: Function
'TestGetNodesInfoPodsWithAffinity' is too long (155 > 120) (funlen)
(2)
pkg/plugin/predicates/predicate_manager_test.go:360: Function
'TestPodFitsSelector' is too long (694 > 120) (funlen)
(3)
func TestPodFitsSelector(t *testing.T) {
pkg/plugin/predicates/predicate_manager_test.go:1205: Function
'TestInterPodAffinity' is too long (944 > 120) (funlen)
(4)
pkg/cache/task_state.go:317: Function 'newTaskState' is too long (124 > 120)
(funlen)
func newTaskState() *fsm.FSM {
pkg/cache/application_test.go:752: Function 'TestTryReservePostRestart' is too
long (123 > 120) (funlen)
(5)
func TestTryReservePostRestart(t *testing.T) {
pkg/cache/context_test.go:858: Function 'TestRecoverTask' is too long (138 >
120) (funlen)
func TestRecoverTask(t *testing.T) {
pkg/cache/context_test.go:1484: Function 'TestAddApplicationsWithTags' is too
long (145 > 120) (funlen)
(6)
func TestAddApplicationsWithTags(t *testing.T) {
pkg/cache/task_test.go:493: Function 'TestHandleSubmitTaskEvent' is too long
(123 > 120) (funlen)
> fix lint issues
> ---------------
>
> Key: YUNIKORN-182
> URL: https://issues.apache.org/jira/browse/YUNIKORN-182
> Project: Apache YuniKorn
> Issue Type: Task
> Components: build
> Reporter: Wilfred Spiegelenburg
> Assignee: Yun Sun
> Priority: Minor
> Labels: pull-request-available
>
> When we added the lint test most major issues were fixed. There are still a
> lot of issues specially in tests that need to be fixed.
> This is a container Jira to track that work on both the k8shim as the core
> repos.
> Work should be split into multiple parts (per linter?)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]