标签: code-cleanup

make clean、make clobber、make distclean、make mrproper 和 make realclean 之间有什么区别?

我并不总是写 make 文件,但是当我这样做时,我喜欢尝试把它们写好。试图使界面与其他开发人员可能期望的一致总是很困难的。我正在寻找的是所有常见的 make something clean (GNU) make 目标的摘要。

常见的清洁目标有哪些?

每个目标通常什么时候使用?

每个目标与其他目标相比如何?


我曾使用make clean,make clobbermake mrproper之前的系统。那些变得越来越极端;make clean只整理临时文件,make clobber摆脱大部分配置,make mrproper几乎回到刚刚签出的状态。这是正常的秩序吗?应该make mrproper始终删除生成的二进制文件和共享库以进行部署吗?

阅读建议将make distclean事情整理到准备制作分发包的程度。我想这会留下一些自动生成的版本标记文件、文件清单和共享库,但可能会删除您不想存档的临时文件?

make realclean当我在GNU MakeGoals 手册页上看到它时,它对我来说是全新的。正如它列出的那样distcleanclobber我猜它有类似的效果。我是否从未遇到过它,因为它是一个历史文物,或者只是我必须从事的一组项目的特定内容?


抱歉,这有点啰嗦。我找到了将一个目标与另一个目标进行比较的各种问题和答案,但似乎没有一个可以很好地概述。

packaging makefile compilation code-cleanup gnu-make

6
推荐指数
1
解决办法
6145
查看次数

Visual Studio - 代码清理不应用命名首选项

我有一个.editorconfig文件,其中包含我的命名首选项。当我运行代码清理时,它会自动格式化除命名之外的所有其他首选项。当我将鼠标悬停在违反命名首选项的变量上时,它会告诉我它违反了哪一个,我可以右键单击将其更改为正确的格式,但是当像我的其他首选项一样运行代码清理时,这不会自动发生。

我是否缺少 VS 设置以.editorconfig在运行代码清理时自动应用命名首选项?

偏好通知示例:

在此输入图像描述

编辑器配置命名首选项:

# Naming rules

dotnet_naming_rule.private_or_internal_field_should_be_underscore_prefixed_camel_case.severity = warning
dotnet_naming_rule.private_or_internal_field_should_be_underscore_prefixed_camel_case.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_underscore_prefixed_camel_case.style = underscore_prefixed_camel_case


# Symbol specifications

dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.required_modifiers = 

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers = 

dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.applicable_accessibilities = *
dotnet_naming_symbols.method.required_modifiers = 

dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.required_modifiers = 

dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.required_modifiers …
Run Code Online (Sandbox Code Playgroud)

c# code-cleanup visual-studio editorconfig

6
推荐指数
1
解决办法
1454
查看次数

代码清理不会在 Visual Studio 2022 中格式化文档

我在 Visual Studio 17.4.1 中对选项卡大小进行了以下设置:

在此输入图像描述

当我使用Edit->Advanced->Format Document时,我得到以下结果:

在此输入图像描述

我配置了代码清理,据称其中包含格式文档

在此输入图像描述

当我保存或显式使用它时,我得到以下结果:

在此输入图像描述

是否有两个单独的“格式化文档”命令?我应该如何得到相同的结果?

code-cleanup visual-studio-2022

6
推荐指数
1
解决办法
614
查看次数

确定未使用哪些PHP源文件

我有一个大型的网络应用程序,我认为有一堆旧文件不再使用,是否有一个应用程序可以告诉我这些文件是什么?

php code-cleanup

5
推荐指数
1
解决办法
1996
查看次数

什么R#设置重新格式化这一行?

VS2010/R#5.1

我有这个代码的"行":

With.Mocks(_mocks).Expecting(() => {
    _fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData);
}).Verify(() => {

});
Run Code Online (Sandbox Code Playgroud)

我执行R#代码清理,它更改代码如下:

With.Mocks(_mocks).Expecting(() => { _fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData); }).Verify(() => { });
Run Code Online (Sandbox Code Playgroud)

也就是说,它重新格式化语句,使其完全出现在一行上.

IDE/R#设置对此负责是什么?当我执行R#代码清理时,我可以更改什么来保留我的换行符?

我会想到'R#/选项/语言/ C#/格式化样式/换行和换行/保留现有格式/保留现有换行符',但这似乎没有任何区别.

c# code-formatting code-cleanup visual-studio-2010 resharper-5.x

5
推荐指数
1
解决办法
91
查看次数

如何调整ReSharper/VS2010中参数的左边距?

这很愚蠢,但是当我有这样的事情时

SomethingStupid.Whatever(string a, string b, string c);
Run Code Online (Sandbox Code Playgroud)

然后我像这样打破它们:

SomethingStupid.Whatever(string a,
     string b,
     string c);
Run Code Online (Sandbox Code Playgroud)

当我想在这里看到它们时,我的代码清理将它们移动到那个位置:

SomethingStupid.Whatever(string a,
                         string b,
                         string c);
Run Code Online (Sandbox Code Playgroud)

对于我的生活,我无法弄清楚这个设置在哪里,有什么想法吗?

code-cleanup visual-studio-2010 resharper-5.1

5
推荐指数
1
解决办法
688
查看次数

Uncrustify:嵌套块indeting是错误的

我有这个代码:

dispatch_async(dispatch_get_main_queue(), ^{
    if (self.adAppearBlockIsAnimated) {
        [UIView animateWithDuration:kAnimationTime animations:^{
            self.adAppearBlock();
        }];
    }
});
Run Code Online (Sandbox Code Playgroud)

不幸的是,Uncrustify让它看起来像:

dispatch_async(dispatch_get_main_queue(), ^{
    if (self.adAppearBlockIsAnimated) {
        [UIView animateWithDuration:kAnimationTime animations:^{
                self.adAppearBlock();
            }];
    }
});
Run Code Online (Sandbox Code Playgroud)

我的配置:

indent_oc_block=true
indent_oc_block_msg = 0
Run Code Online (Sandbox Code Playgroud)

有谁知道如何使它看起来正常吗?嵌套块中没有额外的空格.

编辑:我现在无法发表评论,我正在使用xCode.

formatting objective-c code-cleanup ios uncrustify

5
推荐指数
1
解决办法
844
查看次数

构造函数依赖注入的循环依赖性

我在一个项目中使用Netty(4.0.4.Final),并且我一直在遇到一个我需要考虑的循环依赖.这个问题主要涉及分解循环依赖的概念,但我会在熟悉的人中使用一些Netty术语.既然我的问题实际上并不在于Netty,我决定不对其进行标记.

下面,我发布了我的代码,省略了我认为不相关的部分.

情况

我有一个MyServer类添加ChannelInboundHandlerAdapterBootstrap:

public class MyServer extends AbstractMyServer {
    private Integer someInteger; //Using Integer just for example's sake.

    public MyServer(MyServerInitializer initializer) {
        //...
        bootstrap.handler(initializer);
        //...
    }

    public void updateInteger(Integer value) {
        someInteger = value;
        //Send an update packet to another server.
    }
}
Run Code Online (Sandbox Code Playgroud)

MyServerInitializer需要添加ChannelInboundHandlerAdapterChannelPipeline:

public class MyServerInitializer extends ChannelInitializer<SocketChannel> {
    private ChannelInboundHandlerAdapter handler;

    public MyServerInitializer(ChannelInboundHandlerAdapter handler) {
        this.handler = handler;
    }

    @Override
    protected void initChannel(SocketChannel ch) throws Exception …
Run Code Online (Sandbox Code Playgroud)

java factory circular-dependency code-cleanup

5
推荐指数
1
解决办法
1508
查看次数

在bash中,哪些陷阱由函数和内置函数继承?

在时,我还不清楚在哪个陷阱上继承bash。联机帮助页上说:

当执行除内置函数或shell函数以外的简单命令时,将在单独的执行环境中调用该命令[...] [T]由shell捕获的陷阱将重置为从shell的父级继承的值,并陷阱被shell忽略的被忽略[。]

稍后,它说子shell的行为方式相同。

我认为这对我来说很有意义。这听起来像一颗炮弹取消设置一个陷阱,即得到任何子shell想起和诸如此类的东西,如果一个壳,同时设定一个陷阱,那被遗忘。我不知道为什么要做出这种设计选择,但是至少我认为我了解发生了什么。

但有关命令什么内建命令或shell的功能呢?两者的行为是否有所不同(就陷阱继承而言)?我在手册中找不到完整的说明,据我所知,一切正常。似乎它们通常是从父级继承的,但是有像ERR和这样的异常RETURN,每个异常仅在使用某些shell选项时才由函数继承。

我的问题是:

  • 陷阱继承对内置函数和函数起作用的典型方式是什么?例如,关于设置陷阱还是不设置陷阱,在大多数命令看来都是如此吗?

  • 所有函数和内建函数的行为方式都一样吗?(请不要告诉我每个内置函数都有一套单独的规则...)

  • 有什么例外?即,默认情况下哪些信号的行为不同,哪些功能可以通过shell选项和其他功能更改其默认行为?我知道ERRRETURN,但是还有其他人吗?尽我所能,在任何地方都找不到一个简单的列表。

  • 函数或内建函数何时可以影响父级的陷阱?trap - SIGSPECvs. 如何trap '' SIGSPEC发挥作用?

谢谢!

PS:我正在使用GNU bash版本“ 4.4.19(1)-发行版”。

bash shell code-cleanup

5
推荐指数
1
解决办法
127
查看次数

哪个是使用来自react-redux,Parent vs Child组件的connect()的首选方法?

我在有效的方式有点搞不清使用connect()反应-终极版库.我有打击组件

class SignUp extends React.Component {
//some functions
render(){
  return (
      <SignUpPageWrapper>
        <SignUpPage>
          <SignUpPageLeft>
            <SignUpLeftText /> //component
          </SignUpPageLeft>
          <SignUpPageRight>
            <SignUpForm /> //component <=
          </SignUpPageRight>
        </SignUpPage>
        <SignUpFooter /> //component
      </SignUpPageWrapper>
  );
 }
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,很少有反应Component(//评论),其余const来自样式组件库.

截至目前,我已经制作SignUpForm了一个容器,即包裹connect()

class SignUpForm extends React.Component {
  //lots of code here using this.props from connect()

}    
export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SignUpForm);
Run Code Online (Sandbox Code Playgroud)

但我觉得这是不使用的有效途径connect,更好的将是父组件包装SignUpconnect类似下面,然后传递methods,并statesprops孩子部件. …

code-cleanup reactjs react-redux

5
推荐指数
2
解决办法
621
查看次数