New solution-wide unused code feature

What is the best way to handle code that is referenced in custom
configuration files or plugins loaded at runtime? In general types that are
not directly used in code?

Create a "placebo" file that uses all the types?

Is there a way to change severity on internal types or methods that are
unused independent of public types?

Morty

5 comments

Hello Morten,

I usually mark such types with special custom attributes, like
or . This way you not only supress the warning, but tell
other people what's happening here. Consider if there were no warning like
that, but some other developer use "Find Usages" on it and see no usages!
It can instantly delete type as not being used.n Plus, with custom attributes
you can easily find all types of particular kind.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


MA> What is the best way to handle code that is referenced in custom
MA> configuration files or plugins loaded at runtime? In general types
MA> that are not directly used in code?
MA>
MA> Create a "placebo" file that uses all the types?
MA>
MA> Is there a way to change severity on internal types or methods that
MA> are unused independent of public types?
MA>
MA> Morty
MA>


0

Hi Ilya,

This is a good idea, but can Resharper be configured to use these attributes
in its analysis?

Morty

"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b16a4178cb3f3b05c0f7bf@news.intellij.net...

Hello Morten,

>

I usually mark such types with special custom attributes, like
or . This way you not only
supress the warning, but tell other people what's happening here. Consider
if there were no warning like that, but some other developer use "Find
Usages" on it and see no usages! It can instantly delete type as not being
used.n Plus, with custom attributes you can easily find all types of
particular kind.

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

MA> What is the best way to handle code that is referenced in custom
MA> configuration files or plugins loaded at runtime? In general types
MA> that are not directly used in code?
MA> MA> Create a "placebo" file that uses all the types?
MA> MA> Is there a way to change severity on internal types or methods
that
MA> are unused independent of public types?
MA> MA> Morty
MA>

0

Hello Morten,

It shouldn't mark types annotated with attributes as being unused. If this
is not the case, this is probably a bug.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


MA> Hi Ilya,
MA>
MA> This is a good idea, but can Resharper be configured to use these
MA> attributes in its analysis?
MA>
MA> Morty
MA>
MA> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
MA> news:76a2bd0b16a4178cb3f3b05c0f7bf@news.intellij.net...
MA>
>> Hello Morten,
>>
>> I usually mark such types with special custom attributes, like
>> or . This way you not only
>> supress the warning, but tell other people what's happening here.
>> Consider if there were no warning like that, but some other developer
>> use "Find Usages" on it and see no usages! It can instantly delete
>> type as not being used.n Plus, with custom attributes you can easily
>> find all types of particular kind.
>>
>> Sincerely,
>> Ilya Ryzhenkov
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>> MA> What is the best way to handle code that is referenced in custom
>> MA> configuration files or plugins loaded at runtime? In general
>> types
>> MA> that are not directly used in code?
>> MA> MA> Create a "placebo" file that uses all the types?
>> MA> MA> Is there a way to change severity on internal types or
>> methods
>> that
>> MA> are unused independent of public types?
>> MA> MA> Morty
>> MA>


0

OK, I misunderstood you.

I didn't realize that it ignored all attributed types?

What about an option to treat internal types differently than public types
as far as severity goes?

Morty

"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b16a4278cb3f48461d36c5@news.intellij.net...

Hello Morten,

>

It shouldn't mark types annotated with attributes as being unused. If this
is not the case, this is probably a bug.

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

MA> Hi Ilya,
MA> MA> This is a good idea, but can Resharper be configured to use these
MA> attributes in its analysis?
MA> MA> Morty
MA> MA> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
MA> news:76a2bd0b16a4178cb3f3b05c0f7bf@news.intellij.net...
MA>

>>> Hello Morten,
>>>
>>> I usually mark such types with special custom attributes, like
>>> or . This way you not only
>>> supress the warning, but tell other people what's happening here.
>>> Consider if there were no warning like that, but some other developer
>>> use "Find Usages" on it and see no usages! It can instantly delete
>>> type as not being used.n Plus, with custom attributes you can easily
>>> find all types of particular kind.
>>>
>>> Sincerely,
>>> Ilya Ryzhenkov
>>> JetBrains, Inc
>>> http://www.jetbrains.com
>>> "Develop with pleasure!"
>>> MA> What is the best way to handle code that is referenced in custom
>>> MA> configuration files or plugins loaded at runtime? In general
>>> types
>>> MA> that are not directly used in code?
>>> MA> MA> Create a "placebo" file that uses all the types?
>>> MA> MA> Is there a way to change severity on internal types or
>>> methods
>>> that
>>> MA> are unused independent of public types?
>>> MA> MA> Morty
>>> MA>
>

0

Hello Morten,

What is so special about internal types in regards of used/unused state?
What is actual scenario you are facing and (as far as I understood) ReSharper
gives false positives in your solution?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


MA> OK, I misunderstood you.
MA>
MA> I didn't realize that it ignored all attributed types?
MA>
MA> What about an option to treat internal types differently than public
MA> types as far as severity goes?
MA>
MA> Morty
MA>
MA> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
MA> news:76a2bd0b16a4278cb3f48461d36c5@news.intellij.net...
MA>
>> Hello Morten,
>>
>> It shouldn't mark types annotated with attributes as being unused. If
>> this is not the case, this is probably a bug.
>>
>> Sincerely,
>> Ilya Ryzhenkov
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>> MA> Hi Ilya,
>> MA> MA> This is a good idea, but can Resharper be configured to use
>> these
>> MA> attributes in its analysis?
>> MA> MA> Morty
>> MA> MA> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
>> MA> news:76a2bd0b16a4178cb3f3b05c0f7bf@news.intellij.net...
>> MA>
>>>> Hello Morten,
>>>>
>>>> I usually mark such types with special custom attributes, like
>>>> or . This way you not only
>>>> supress the warning, but tell other people what's happening here.
>>>> Consider if there were no warning like that, but some other
>>>> developer use "Find Usages" on it and see no usages! It can
>>>> instantly delete type as not being used.n Plus, with custom
>>>> attributes you can easily find all types of particular kind.
>>>>
>>>> Sincerely,
>>>> Ilya Ryzhenkov
>>>> JetBrains, Inc
>>>> http://www.jetbrains.com
>>>> "Develop with pleasure!"
>>>> MA> What is the best way to handle code that is referenced in
>>>> custom
>>>> MA> configuration files or plugins loaded at runtime? In general
>>>> types
>>>> MA> that are not directly used in code?
>>>> MA> MA> Create a "placebo" file that uses all the types?
>>>> MA> MA> Is there a way to change severity on internal types or
>>>> methods
>>>> that
>>>> MA> are unused independent of public types?
>>>> MA> MA> Morty
>>>> MA>


0

Please sign in to leave a comment.