Make sure to read this post before raising a thread here:
Then tell us:
-
What language is this for?
- Typescript with cdk8s framework.
-
Which rule?
-
Why do you believe it’s a false-positive/false-negative?
- The cdk constructs require to declare constructors for the resources being created in the code without being any assignment.
-
Are you using
- SonarCloud
-
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
-
Setup a cdk8s project and try to create any resource. Example:
import { KubeIngress } from "../../imports/k8s";
import { Chart, ChartProps } from "cdk8s";
import { HttpIngressPathType } from "cdk8s-plus-29";
import { Construct } from "constructs";
export type LocalKongIngressProps = ChartProps & {};
export class LocalKongIngressChart extends Chart {
constructor(scope: Construct, id: string, props: LocalKongIngressProps) {
const { namespace } = props;
super(scope, id, props);
/**
* Create ingress
*/
new KubeIngress(this, "kong-ingress", {
Either remove this useless object instantiation of "KubeIngress" or use it.
metadata: {
namespace,
name: "kong-ingress",
},
spec: {
ingressClassName: "loc00-nginx",
rules: [
{
host: "school.bettermarks.loc",
http: {
paths: [
{
path: "/",
pathType: HttpIngressPathType.PREFIX,
backend: {
service: {
name: "kong-authx",
port: {
number: 8000,
},
},
},
},
],
},
},
],
},
});
}
}