投稿時間:2022-07-03 01:09:14 RSSフィード2022-07-03 01:00 分まとめ(15件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita flacファイルをm4aにタグやカバー画像などすべて変換する(Python) https://qiita.com/masa669a/items/63f91debf6eb08d3ab86 flacma 2022-07-03 00:36:11
python Pythonタグが付けられた新着投稿 - Qiita Raspberry PiとSwitchbotを使って自然に起きられる光目覚ましを作ってみた(python) https://qiita.com/am_yui/items/c1ae43e97c726b085668 raspberrypi 2022-07-03 00:13:46
python Pythonタグが付けられた新着投稿 - Qiita PythonとSeleniumとWebDriverでドライバとブラウザのバージョン確認 https://qiita.com/feo52/items/ffe8051f7e7aca96a1b8 portwebdriverdefmaintry 2022-07-03 00:10:00
海外TECH MakeUseOf Why Do Bitcoin Transactions Take So Long? https://www.makeuseof.com/why-do-bitcoin-transactions-take-so-long/ bitcoin 2022-07-02 15:45:14
海外TECH MakeUseOf What Is a Raspberry Pico W and What Can You Use It For? https://www.makeuseof.com/raspberry-pi-pico-w-what-you-can-use-it-for/ board 2022-07-02 15:30:14
海外TECH MakeUseOf Is Your Audio Device Automatically Switching Itself in Windows 11? Try These 7 Fixes https://www.makeuseof.com/windows-11-audio-device-changing/ Is Your Audio Device Automatically Switching Itself in Windows Try These FixesIf Windows seems to have a better idea over which audio device to use than you here s how to stop it from changing your audio device 2022-07-02 15:15:14
海外TECH DEV Community How to Detect Duplicate Code in a Project! https://dev.to/kai_wenzel/how-to-detect-duplicate-code-in-a-project-3ln3 How to Detect Duplicate Code in a Project With the continuous iteration of business requirements similar requirements will inevitably arise in a project As a front line R amp D student you should have experienced such a situation When encountering similar implementations in many cases functions or components with the same functions are directly copied and used Of course a large part of the reason is that the development time of the requirements is relatively tight To quickly complete the requirements of the PM this is done However such a long term accumulation of duplicate code will make later projects more and more difficult to maintain On the one hand the duplicate code will make the project itself bloated quickly and the readability will become poor on the other hand if functional rectification or expansion is to be carried out should the same code in so many places be changed synchronously If you want to change this is also a lot of research and development costs which will eventually lead to worse and worse maintainability of the project Therefore duplication of code affects the overall quality of the project to a certain extent In the quality engineering construction system the detection of duplicate code is also an important part In today s article I will discuss with you how to detect and eliminate duplicate code in front end projects ExampleLet s cut into the topic of this article with a simple example Suppose I currently have a React project with two pages one is the about page and the other is the home page both of which have a table component with the same functions The code is shown below about pageimport React from react export default gt console log this is about page return lt gt lt table border gt lt tr gt lt th gt Month lt th gt lt th gt Savings lt th gt lt tr gt lt table gt this is about page lt gt view rawabout js hosted with by GThe about page has a table component and then looking at the home page you can also see a table component home pageimport React from react export default gt console log this is home page return lt gt lt table border gt lt tr gt lt th gt Month lt th gt lt th gt Savings lt th gt lt tr gt lt table gt this is home page lt gt How to detect duplicate code with engineering capabilities At present in the open source community there is an open source project called jscpd which has good support for duplicate code detection capabilities The GitHub address is Next I will teach you how to use jscpd to detect duplicate code in your project Generally in an engineering system a series of atomic services form an entire engineering detection link The implementation of each atomic service is mostly the implementation of scripts which may be Node scripts or Python scripts etc we don t need to care about the specific implementation of the technology stack as long as the function can be realized Here I take the two pages mentioned above as an example to introduce you to how to use jscpd to detect duplicate code in a project in two ways The first way is to enter the sell command directly in the console In this way you need to install jscpd dependencies globally the command is npm i g jscpd After the installation is complete you can go to the root path of the React project and execute the following command jscpd p src js k l Here I first explain the above parameters p refers to the regular matching of all files by glob pattern then src js is to detect all files with the suffix js in the src directory k refers to the minimum number of repetitions of tokens in the code tag You can understand token as a word here it is set to then the code snippet will only be detected if it contains words or more l refers to the minimum number of lines of code to be detected It is set to here You can understand that the detection will only be performed for codes with more than lines If you want to know more parameters you can execute jscpd h on the command line to view I will show you the execution result here As you can see from this result the final result detected duplicate code in two files a total of lines and tokens Of course the repeated code may be a component a function or a class There are many situations and we need to analyze the specific situation ConclusionThe detection of duplicate code is a necessary part of quality engineering Neglecting this part may make our code less readable and more difficult to maintain I have summarized a few points here you can refer to them Encapsulating components are very suitable for the example we mentioned above For subcomponents that use the same capabilities in multiple components we should consider encapsulating these same components into public components so that when using other components you can directly refer to the public components Subsequent maintenance is also more convenient If the components are changed the public components can be changed uniformly Extracting functions in simple terms is extracting the same implementation module into a function which is convenient for reuse If it is the same two functions you can directly extract them If the two functions are not the same you can separate the same part from the different parts extract the same part into one function and keep the different parts Method promotion if there are similar implementations in multiple subclasses we can advance the method to the parent class for unified implementation and each subclass can inherit once This can also achieve the effect of eliminating duplicate code That s it and if you found this article helpful please hit the ️ button and share the article so that others can find it easily If you want to see more of this content you can support me on Patreon Thanks for reading and hope you enjoyed 2022-07-02 15:25:53
ニュース @日本経済新聞 電子版 首相の演説回数、東北に重き 参議院選挙データ分析 https://t.co/FymLK0rh5l https://twitter.com/nikkei/statuses/1543250546269626368 参議院選挙 2022-07-02 15:09:37
ニュース BBC News - Home Chris Pincher MP seeking medical support after groping claim https://www.bbc.co.uk/news/uk-62023278?at_medium=RSS&at_campaign=KARANGA constituency 2022-07-02 15:30:10
ニュース BBC News - Home Lysychansk: Heavy fighting rages in Ukraine-held eastern city https://www.bbc.co.uk/news/world-europe-62022471?at_medium=RSS&at_campaign=KARANGA artillery 2022-07-02 15:32:37
ニュース BBC News - Home Durban July: South Africa's most fashionable horse race returns https://www.bbc.co.uk/news/world-africa-62020414?at_medium=RSS&at_campaign=KARANGA covid 2022-07-02 15:46:07
ニュース BBC News - Home British Grand Prix: Carlos Sainz on pole in thrilling wet qualifying https://www.bbc.co.uk/sport/formula1/62022810?at_medium=RSS&at_campaign=KARANGA British Grand Prix Carlos Sainz on pole in thrilling wet qualifyingFerrari s Carlos Sainz snatches pole position for the British Grand Prix from Max Verstappen with the last lap of a thrilling wet qualifying session 2022-07-02 15:10:42
ニュース BBC News - Home Tour de France 2022: Fabio Jakobsen edges sprint finish to win stage two https://www.bbc.co.uk/sport/cycling/62022776?at_medium=RSS&at_campaign=KARANGA denmark 2022-07-02 15:54:00
北海道 北海道新聞 米投資ファンド優先交渉へ そごう西武売却で https://www.hokkaido-np.co.jp/article/701142/ 投資ファンド 2022-07-03 00:46:00
北海道 北海道新聞 警官名乗る男らに200万円盗まれる 札幌の80代女性 https://www.hokkaido-np.co.jp/article/701135/ 札幌市西区 2022-07-03 00:14:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)