bergerx/kubectl-status

View on GitHub
pkg/input/input.go

Summary

Maintainability
A
1 hr
Test Coverage

Method ResourceRepo.mappingFor has 6 return statements (exceeds 4 allowed).
Open

func (r *ResourceRepo) mappingFor(resourceOrKindArg string) (*meta.RESTMapping, error) {
    fullySpecifiedGVR, groupResource := schema.ParseResourceArg(resourceOrKindArg)
    gvk := schema.GroupVersionKind{}
    restMapper, err := r.f.ToRESTMapper()
    if err != nil {
Severity: Major
Found in pkg/input/input.go - About 40 mins to fix

    Method ResourceRepo.Owners has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
    Open

    func (r *ResourceRepo) Owners(obj Object) (out Objects, err error) {
        uobj := obj.Unstructured()
        namespace := uobj.GetNamespace()
        owners := uobj.GetOwnerReferences()
        if len(owners) == 0 {
    Severity: Minor
    Found in pkg/input/input.go - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    exported method Object.Unstructured should have comment or be unexported
    Open

    func (u Object) Unstructured() *unstructured.Unstructured {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported function NewResourceRepo should have comment or be unexported
    Open

    func NewResourceRepo(factory util.Factory) (*ResourceRepo, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.Ingresses should have comment or be unexported
    Open

    func (r *ResourceRepo) Ingresses(namespace string) (*netv1.IngressList, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.DynamicObjects should have comment or be unexported
    Open

    func (r *ResourceRepo) DynamicObjects(gvr schema.GroupVersionResource, namespace string) (Objects, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.Objects should have comment or be unexported
    Open

    func (r *ResourceRepo) Objects(namespace string, args []string, labelSelector string) (Objects, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.Services should have comment or be unexported
    Open

    func (r *ResourceRepo) Services(namespace string) (*corev1.ServiceList, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported type Objects should have comment or be unexported
    Open

    type Objects []Object
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.Endpoints should have comment or be unexported
    Open

    func (r *ResourceRepo) Endpoints(namespace string) (*corev1.EndpointsList, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.CLIQueryResults should have comment or be unexported
    Open

    func (r *ResourceRepo) CLIQueryResults(args []string) *resource.Result {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.Owners should have comment or be unexported
    Open

    func (r *ResourceRepo) Owners(obj Object) (out Objects, err error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.FirstObject should have comment or be unexported
    Open

    func (r *ResourceRepo) FirstObject(namespace string, args []string, labelSelector string) (Object, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.Service should have comment or be unexported
    Open

    func (r *ResourceRepo) Service(namespace, name string) (*corev1.Service, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported type ResourceRepo should have comment or be unexported
    Open

    type ResourceRepo struct {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.GVRFor should have comment or be unexported
    Open

    func (r *ResourceRepo) GVRFor(resourceOrKindArg string) (schema.GroupVersionResource, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.NonTerminatedPodsOnTheNode should have comment or be unexported
    Open

    func (r *ResourceRepo) NonTerminatedPodsOnTheNode(nodeName string) (Objects, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.ObjectEvents should have comment or be unexported
    Open

    func (r *ResourceRepo) ObjectEvents(u *unstructured.Unstructured) (*corev1.EventList, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    exported method ResourceRepo.DynamicObject should have comment or be unexported
    Open

    func (r *ResourceRepo) DynamicObject(gvr schema.GroupVersionResource, namespace string, name string) (Object, error) {
    Severity: Minor
    Found in pkg/input/input.go by golint

    There are no issues that match your filters.

    Category
    Status