179 questions
9
votes
2
answers
185
views
How to correctly resolve unused warning when instance is being used in a fold operator
In the code below, I get the follow compilation warning:
error: variable 'process_arg' set but not used [-Werror=unused-but-set-variable]
const auto process_arg = [&]<typename T>(const ...
0
votes
0
answers
73
views
Why IntelliJ doesn't produce an unused warning for assignment to field in Kotlin
For this piece of Kotlin code
class X {
private var v = 0
fun f() {
v = 0
}
}
I don't see a warning about v being unused in IntelliJ. v is not being accessed anywhere in the ...
2
votes
2
answers
123
views
Set variables declared through let* as ignorable
I am trying to write a macro that would generate code that looks like:
(defun test ()
(let* ((_ (exp1))
(_ (exp2))
...
(_ (expn)))))
The (expn) calls might be ...
0
votes
0
answers
1k
views
How to identify unused methods, codes, libraries and references in VScode
Team,
I need to identify & remove unused variables (arguments, local variables, class member variables), Libraries, and references that are unused in VS code.
I have also tried to find out some ...
0
votes
1
answer
58
views
Ignore return variable from an API function in VBA
I'm trying to convert some python scripts to VBA and haven't been able to find an equivalent to the underscore method to ignore a return variable from a function I don't want to use.
In python I would ...
2
votes
1
answer
948
views
ESLint no-unused-var error for DI variables in Angular
I've got an Angular 14.2 Project and I am trying to setup ESLint for it. The problem is that I get false positives for the no-unused-var error and it seems like it only does this for variables which ...
4
votes
3
answers
273
views
Unused loop variables in Lisp
Sometime, I need to iterate $n$ times where $n$ is the number of elements in a list. Of course, I could write something like:
(loop for i from 0 below (list-length l)
do something)
But I like ...
2
votes
2
answers
2k
views
How to suppress Kotlin unused parameter warning in all test classes?
In parameterized tests I use hint parameter to clarify test case naming. From the static analyzer point of view this parameter is never used, so this warning from kotlin-maven-plugin appears in the ...
-1
votes
1
answer
704
views
Unused variable outside of a for-loop in Go [closed]
I can't compile the following Go code. I keep getting an error that variable 'header' is not used. I'm trying to read and process a CSV file. The file is read line by line an so I need to save the ...
0
votes
1
answer
276
views
How to deal with sometimes unused arguments of function?
Could you please advise me how to deal with sometimes unused arguments of function? Thank you in advance!
Function:
def foo(a, b=2, c="default"):
print(c)
return a + b
Usage:
arg_1 = ...
3
votes
0
answers
782
views
How to gray out unused C++ variables in VSCode?
VSCode grays out unused variables/imports in JS and TS files.
I use VSCode for writing C++ code also and I have the C/C++ extension installed too.
I want VSCode to also gray out unused C++ variables ...
2
votes
2
answers
9k
views
How to fix "error:expected primary-expression before ‘,’ token"
I am trying to make a first fit memory management code but everytime I try to run it I keep getting incomplete results in the output and these errors
error:expected primary-expression before ‘,’ token
...
-1
votes
1
answer
1k
views
Unused local variable false positive
While using sonar lint version 6.3.0.39716, it reports the following variable as unused.
void read() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(...
0
votes
1
answer
371
views
How to find unused variables in a Makefile
I'm maintaining a Makefile for a project, which contains many variable declarations:
DOCKER_IMAGE_VERSION := latest
DOCKER_EXPOSE_PORT := 8080
PIP := python -m pip
...
Sometimes the lines using these ...
7
votes
2
answers
3k
views
Remove a property using object destructuring, without eslint no-unused-vars error [duplicate]
Consider the following code where I create a "copy" of x with one of the properties removed, using destructuring:
const x = { a: 1, b: 2, c: 3};
const { a, ...x2} = x;
console.log(x);
...
1
vote
1
answer
73
views
Package: Hypervolume "ununsed Argument: bandwith"
I have a question about the Hypervolume Package in R.
I´m working on rangesize of mamals and their climatic conditions. So i got a Code from a former student and try to rerun it.
For the analysis i ...
2
votes
0
answers
3k
views
How to suppress warnings from a go module?
I'm using gosseract, a Go OCR package that uses Tesseract for reading characters from images. I am using the demo's code right now like so:
client := gosseract.NewClient()
defer client.Close()
client....
0
votes
1
answer
703
views
In Microsoft Dynamics, 365, why can't I inline an instance of FormDataSource?
I have the following method which compiles:
private void onModifiedFilter(FormControl sender)
{
FormDataSource mainAccount_ds = sender.formRun()
.dataSource(...
0
votes
1
answer
6k
views
Why an "unused variable" compilation error when ignoring the result of append?
why if we append data in slice and not use it (variable mySlice in the program), why not throw the error message "unused variable" golang. Thankyou
#example
var mySlice []string
mySlice = ...
2
votes
1
answer
375
views
Suppressing Warning in Rescript: Js.Promise.make
When making a promise in Rescript:
let myPromise = Js.Promise.make((~resolve, ~reject) => resolve(. 2))
The ReScript compiler will give a warning on unused variable reject.
Is there a way to ...
14
votes
1
answer
11k
views
MSBuild - Treat Warnings from editorconfig as Errors (enforce during build)
I set up an .editorconfig file for my project and it works perfectly in my IDE and throws the right warnings. Examples: IDE0052 (unused variables) and IDE0055 (wrong formatting).
However, I would like ...
0
votes
1
answer
203
views
Unused variables and TypeError: cannot unpack non-iterable int object
Hello I'm a newbie at python. In my function, I keep getting warnings of unused variables r,g,b,a. Can someone explain it for me?
def encode_image(self,img, msg):
length = len(msg)
if ...
1
vote
1
answer
66
views
linfun function problem (unused arguments)
I'm trying to run this code, but I'm having some problem with the linfun function, and I don't know how to fix it.
The error is:
"Error in linfun(a = x.T, d = -sum(x.T * w)) : unused arguments (...
0
votes
1
answer
373
views
What is the correct way to create an object that I don't need a reference to in TypeScript?
I need to create an object, and I don't need the reference to it once it's created. I have this code:
const myPieChart = new Chart(context, {
type: "pie",
data: dataSource
});
But I ...
1
vote
2
answers
809
views
How can I discard both of an argument and a local variable in the same scope?
My current code seems like this:
// for given methods like these:
// void Foo(Action<int> action)
// async Task DoAsync()
Foo(unusedInt =>
{
var unusedTask = DoAsync();
});
I know I can ...