Cyclomatic complexity validate errors:
Magento marketplace rejected with above error means your code doesn't validate Cyclomatic complexity.
I can suggest solutions for some errors, not all.
FILE: ...agento2\app\code\Marstranslation\Marstranslation\Helper\Data.php
1. 85 | WARNING | [ ] Function's cyclomatic complexity (20) exceeds 10; consider refactoring the function
This error is because when code is complexity is checked, it will check how many loops in the code. More loops will increase cyclomatic complexity of your code.
So, reduce number of loops in the code. Create another function and add some code in new function to refactor. This will reduce cyclomatic complexity.
2. 195 | WARNING | [ ] The use of function fopen() is discouraged
Using fopen() in the code will increase possibility to hack your code. This is discouraged to use in magento2. Because magento2 provides framework functions for this.
i.e. \Magento\Framework\Filesystem\Driver\File:fileOpen
3. 302 | WARNING | [ ] Array size calculation function count() detected in loop.....
309 | WARNING | [ ] Array size calculation function count() detected in loop
I think there should not be any functions like count, load inside the looping. To avoid this error, create new function and add you code for count() inside the new function.
If you using ->count() method on collection to check collection count, then this should not use.
You should use ->getSize() method on collection.
4. 364 | WARNING | [ ] The direct use of ObjectManager is discouraged. Inject necessary dependencies via constructor.
Object manager is deprecated.
If you want to load method of any class then you must use dependency injection functionality of Magento2.
Best Answer
Have a look at the Interfaces available inside
Magento\Framework
.There are classes to help you, for example
Magento\Framework\Filesystem\DriverInterface
gives you access to afileGetContents
function:Which is implemented inside
Magento\Framework\Filesystem\Driver
This is going to be your best option.